Skip to content

Commit

Permalink
blk-mq: fix potential hang if rolling wakeup depth is too high
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 4bb659b
Cc: [email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
axboe committed Oct 7, 2014
1 parent d8f429e commit abab13b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/blk-mq-tag.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,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;
}
Expand Down

0 comments on commit abab13b

Please sign in to comment.