summaryrefslogtreecommitdiffstats
path: root/block/blk-mq-sched.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2017-11-10 17:13:21 +0100
committerJens Axboe <axboe@kernel.dk>2017-11-11 03:55:57 +0100
commit79f720a751cad613620d0237e3b44f89f4a69181 (patch)
tree4f530507baac038f38fa6974734f3a0595b2abb1 /block/blk-mq-sched.c
parentblock: avoid null pointer dereference on null disk (diff)
downloadlinux-79f720a751cad613620d0237e3b44f89f4a69181.tar.xz
linux-79f720a751cad613620d0237e3b44f89f4a69181.zip
blk-mq: only run the hardware queue if IO is pending
Currently we are inconsistent in when we decide to run the queue. Using blk_mq_run_hw_queues() we check if the hctx has pending IO before running it, but we don't do that from the individual queue run function, blk_mq_run_hw_queue(). This results in a lot of extra and pointless queue runs, potentially, on flush requests and (much worse) on tag starvation situations. This is observable just looking at top output, with lots of kworkers active. For the !async runs, it just adds to the CPU overhead of blk-mq. Move the has-pending check into the run function instead of having callers do it. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-mq-sched.c')
-rw-r--r--block/blk-mq-sched.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
index 6f4bdb8209f7..c117bd8fd1f6 100644
--- a/block/blk-mq-sched.c
+++ b/block/blk-mq-sched.c
@@ -81,12 +81,7 @@ static bool blk_mq_sched_restart_hctx(struct blk_mq_hw_ctx *hctx)
} else
clear_bit(BLK_MQ_S_SCHED_RESTART, &hctx->state);
- if (blk_mq_hctx_has_pending(hctx)) {
- blk_mq_run_hw_queue(hctx, true);
- return true;
- }
-
- return false;
+ return blk_mq_run_hw_queue(hctx, true);
}
/*