summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-04-13 08:06:49 +0200
committerJens Axboe <axboe@kernel.dk>2023-04-13 06:57:18 -0600
commitcd735e11130d4c84a073e1056aa019ca0f3305f9 (patch)
treea52ca4eee82889ccc48a275432b5caf75b2d5ea2 /block
parentc20a1a2c1a9f5b1081121cd18be444e7610b0c6f (diff)
blk-mq: move the blk_mq_hctx_stopped check in __blk_mq_delay_run_hw_queue
For the in-context dispatch, blk_mq_hctx_stopped is alredy checked in blk_mq_sched_dispatch_requests under blk_mq_run_dispatch_ops() protection. For the async dispatch case having a check before scheduling the work still makes sense to avoid needless workqueue scheduling, so just keep it for that case. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20230413060651.694656-4-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ad13d2aa948b..2213117bb1b5 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2223,9 +2223,6 @@ select_cpu:
static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
unsigned long msecs)
{
- if (unlikely(blk_mq_hctx_stopped(hctx)))
- return;
-
if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) {
if (cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask)) {
__blk_mq_run_hw_queue(hctx);
@@ -2233,6 +2230,8 @@ static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
}
}
+ if (unlikely(blk_mq_hctx_stopped(hctx)))
+ return;
kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work,
msecs_to_jiffies(msecs));
}