]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
blk-mq: fix potential hang if rolling wakeup depth is too high
authorJens Axboe <axboe@fb.com>
Tue, 7 Oct 2014 14:39:20 +0000 (08:39 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:25 +0000 (10:10 -0800)
commit abab13b5c4fd1fec4f9a61622548012d93dc2831 upstream.

We currently divide the queue depth by 4 as our batch wakeup
count, but we split the wakeups over BT_WAIT_QUEUES number of
wait queues. This defaults to 8. If the product of the resulting
batch wake count and BT_WAIT_QUEUES is higher than the device
queue depth, we can get into a situation where a task goes to
sleep waiting for a request, but never gets woken up.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Fixes: 4bb659b156996
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-mq-tag.c

index c1b92426c95e28139134e51a68de2f724f8979f5..74a4168ea34e7cb3df65d218c8698e4c8eefde30 100644 (file)
@@ -463,8 +463,8 @@ static void bt_update_count(struct blk_mq_bitmap_tags *bt,
        }
 
        bt->wake_cnt = BT_WAIT_BATCH;
-       if (bt->wake_cnt > depth / 4)
-               bt->wake_cnt = max(1U, depth / 4);
+       if (bt->wake_cnt > depth / BT_WAIT_QUEUES)
+               bt->wake_cnt = max(1U, depth / BT_WAIT_QUEUES);
 
        bt->depth = depth;
 }