Commit 36df0107 authored by Jens Axboe's avatar Jens Axboe Committed by Luis Henriques

blk-mq: fix potential hang if rolling wakeup depth is too high

commit abab13b5 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: default avatarBart Van Assche <bvanassche@acm.org>
Fixes: 4bb659b1Signed-off-by: default avatarJens Axboe <axboe@fb.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent c4221e3f
...@@ -463,8 +463,8 @@ static void bt_update_count(struct blk_mq_bitmap_tags *bt, ...@@ -463,8 +463,8 @@ static void bt_update_count(struct blk_mq_bitmap_tags *bt,
} }
bt->wake_cnt = BT_WAIT_BATCH; bt->wake_cnt = BT_WAIT_BATCH;
if (bt->wake_cnt > depth / 4) if (bt->wake_cnt > depth / BT_WAIT_QUEUES)
bt->wake_cnt = max(1U, depth / 4); bt->wake_cnt = max(1U, depth / BT_WAIT_QUEUES);
bt->depth = depth; bt->depth = depth;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment