Skip to content

Commit cd735e1

Browse files
Christoph Hellwigaxboe
authored andcommitted
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>
1 parent c20a1a2 commit cd735e1

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

block/blk-mq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,16 +2223,15 @@ static int blk_mq_hctx_next_cpu(struct blk_mq_hw_ctx *hctx)
22232223
static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
22242224
unsigned long msecs)
22252225
{
2226-
if (unlikely(blk_mq_hctx_stopped(hctx)))
2227-
return;
2228-
22292226
if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) {
22302227
if (cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask)) {
22312228
__blk_mq_run_hw_queue(hctx);
22322229
return;
22332230
}
22342231
}
22352232

2233+
if (unlikely(blk_mq_hctx_stopped(hctx)))
2234+
return;
22362235
kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work,
22372236
msecs_to_jiffies(msecs));
22382237
}

0 commit comments

Comments
 (0)