diff options
| author | Mikulas Patocka <mpatocka@redhat.com> | 2014-05-29 15:03:12 -0700 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-12-27 16:06:55 +0100 |
| commit | b39748e63739e8192fcf21a61a4fa7a7c36564e8 (patch) | |
| tree | d960f1a26c2a48c6f9ce9472aef1f048729a6e32 /include/linux/input-polldev.h | |
| parent | da7888fcc8ee915b8e40f4dab21ed7ca4a65327f (diff) | |
dm-crypt: avoid deadlock in mempools
This patch fixes a theoretical deadlock introduced in the previous patch.
The function crypt_alloc_buffer may be called concurrently. If we allocate
from the mempool concurrently, there is a possibility of deadlock.
For example, if we have mempool of 256 pages, two processes, each wanting 256,
pages allocate from the mempool concurrently, it may deadlock in a situation
where both processes have allocated 128 pages and the mempool is exhausted.
In order to avoid this scenarios, we allocate the pages under a mutex.
In order to not degrade performance with excessive locking, we try
non-blocking allocations without a mutex first and if it fails, we fallback
to a blocking allocation with a mutex.
CRs-fixed: 670391
Change-Id: I6c391dece4ba44fe0b2e9b75ea2b9235bf1b525b
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Patch-mainline: dm-devel @ 04/05/14, 14:07
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'include/linux/input-polldev.h')
0 files changed, 0 insertions, 0 deletions
