dm-crypt: wake just one thread Wake just one thread (the one that performed some encryption last time). It is unclear if this improves or degrades performance. Signed-off-by: Mikulas Patocka --- drivers/md/dm-crypt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: linux-3.1-fast/drivers/md/dm-crypt.c =================================================================== --- linux-3.1-fast.orig/drivers/md/dm-crypt.c 2011-10-24 14:58:26.000000000 +0200 +++ linux-3.1-fast/drivers/md/dm-crypt.c 2011-10-24 17:07:05.000000000 +0200 @@ -678,6 +678,7 @@ static int dmcrypt_thread(void *data) struct dm_crypt_request *dmreqs[DMREQ_PULL_BATCH]; unsigned n_dmreqs; unsigned i; + unsigned long flags; DECLARE_WAITQUEUE(wait, current); @@ -686,7 +687,10 @@ static int dmcrypt_thread(void *data) if (!list_empty(&cc->crypt_thread_list)) goto pop_from_list; - add_wait_queue(&cc->crypt_thread_wait, &wait); + spin_lock_irqsave(&cc->crypt_thread_wait.lock, flags); + __add_wait_queue_exclusive(&cc->crypt_thread_wait, &wait); + spin_unlock_irqrestore(&cc->crypt_thread_wait.lock, flags); + set_task_state(current, TASK_INTERRUPTIBLE); spin_unlock(&cc->crypt_thread_spinlock); @@ -807,7 +811,7 @@ static void crypt_flush_batch(struct cry spin_lock(&cc->crypt_thread_spinlock); list_splice_tail(batch, &cc->crypt_thread_list); spin_unlock(&cc->crypt_thread_spinlock); - wake_up_all(&cc->crypt_thread_wait); + wake_up(&cc->crypt_thread_wait); INIT_LIST_HEAD(batch); }