diff options
author | 2018-05-24 11:00:39 -0600 | |
---|---|---|
committer | 2018-05-24 11:00:39 -0600 | |
commit | e6fc46498784e799d3eb95d83079180e413c4e7d (patch) | |
tree | 63876dd6517d7d170d90d71441392ebdcdff3ea6 /include/linux/sbitmap.h | |
parent | bdi: Move cgroup bdi_writeback to a dedicated low concurrency workqueue (diff) | |
download | linux-e6fc46498784e799d3eb95d83079180e413c4e7d.tar.gz linux-e6fc46498784e799d3eb95d83079180e413c4e7d.tar.bz2 linux-e6fc46498784e799d3eb95d83079180e413c4e7d.zip |
blk-mq: avoid starving tag allocation after allocating process migrates
When the allocation process is scheduled back and the mapped hw queue is
changed, fake one extra wake up on previous queue for compensating wake
up miss, so other allocations on the previous queue won't be starved.
This patch fixes one request allocation hang issue, which can be
triggered easily in case of very low nr_request.
The race is as follows:
1) 2 hw queues, nr_requests are 2, and wake_batch is one
2) there are 3 waiters on hw queue 0
3) two in-flight requests in hw queue 0 are completed, and only two
waiters of 3 are waken up because of wake_batch, but both the two
waiters can be scheduled to another CPU and cause to switch to hw
queue 1
4) then the 3rd waiter will wait for ever, since no in-flight request
is in hw queue 0 any more.
5) this patch fixes it by the fake wakeup when waiter is scheduled to
another hw queue
Cc: <stable@vger.kernel.org>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Modified commit message to make it clearer, and make it apply on
top of the 4.18 branch.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/sbitmap.h')
-rw-r--r-- | include/linux/sbitmap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index 0c4a9c242dd7..e6539536dea9 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -513,6 +513,13 @@ static inline struct sbq_wait_state *sbq_wait_ptr(struct sbitmap_queue *sbq, void sbitmap_queue_wake_all(struct sbitmap_queue *sbq); /** + * sbitmap_queue_wake_up() - Wake up some of waiters in one waitqueue + * on a &struct sbitmap_queue. + * @sbq: Bitmap queue to wake up. + */ +void sbitmap_queue_wake_up(struct sbitmap_queue *sbq); + +/** * sbitmap_queue_show() - Dump &struct sbitmap_queue information to a &struct * seq_file. * @sbq: Bitmap queue to show. |