summaryrefslogtreecommitdiffstats
path: root/block/bfq-iosched.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-01-18 12:34:16 -0500
committerJens Axboe <axboe@kernel.dk>2019-04-13 21:08:22 -0400
commit77f1e0a52d26242b6c2dba019f6ebebfb9ff701e (patch)
treed813fd9cdf53b7d1351f885e2c8706719672fba4 /block/bfq-iosched.c
parent917257daa0fea7a007102691c0e27d9216a96768 (diff)
bfq: update internal depth state when queue depth changes
A previous commit moved the shallow depth and BFQ depth map calculations to be done at init time, moving it outside of the hotter IO path. This potentially causes hangs if the users changes the depth of the scheduler map, by writing to the 'nr_requests' sysfs file for that device. Add a blk-mq-sched hook that allows blk-mq to inform the scheduler if the depth changes, so that the scheduler can update its internal state. Tested-by: Kai Krakow <kai@kaishome.de> Reported-by: Paolo Valente <paolo.valente@linaro.org> Fixes: f0635b8a416e ("bfq: calculate shallow depths at init time") Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bfq-iosched.c')
-rw-r--r--block/bfq-iosched.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index dfb8cb0af13a..5ba1e0d841b4 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -5396,7 +5396,7 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd,
5396 return min_shallow; 5396 return min_shallow;
5397} 5397}
5398 5398
5399static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) 5399static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx)
5400{ 5400{
5401 struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; 5401 struct bfq_data *bfqd = hctx->queue->elevator->elevator_data;
5402 struct blk_mq_tags *tags = hctx->sched_tags; 5402 struct blk_mq_tags *tags = hctx->sched_tags;
@@ -5404,6 +5404,11 @@ static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)
5404 5404
5405 min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags); 5405 min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags);
5406 sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow); 5406 sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow);
5407}
5408
5409static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)
5410{
5411 bfq_depth_updated(hctx);
5407 return 0; 5412 return 0;
5408} 5413}
5409 5414
@@ -5826,6 +5831,7 @@ static struct elevator_type iosched_bfq_mq = {
5826 .requests_merged = bfq_requests_merged, 5831 .requests_merged = bfq_requests_merged,
5827 .request_merged = bfq_request_merged, 5832 .request_merged = bfq_request_merged,
5828 .has_work = bfq_has_work, 5833 .has_work = bfq_has_work,
5834 .depth_updated = bfq_depth_updated,
5829 .init_hctx = bfq_init_hctx, 5835 .init_hctx = bfq_init_hctx,
5830 .init_sched = bfq_init_queue, 5836 .init_sched = bfq_init_queue,
5831 .exit_sched = bfq_exit_queue, 5837 .exit_sched = bfq_exit_queue,