]> git.baikalelectronics.ru Git - kernel.git/commitdiff
blk-mq: Don't disable preemption around __blk_mq_run_hw_queue().
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 22 Jun 2022 08:25:54 +0000 (10:25 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jun 2022 12:29:12 +0000 (06:29 -0600)
__blk_mq_delay_run_hw_queue() disables preemption to get a stable
current CPU number and then invokes __blk_mq_run_hw_queue() if the CPU
number is part the mask.

__blk_mq_run_hw_queue() acquires a spin_lock_t which is a sleeping lock
on PREEMPT_RT and can't be acquired with disabled preemption.

It is not required for correctness to invoke __blk_mq_run_hw_queue() on
a CPU matching hctx->cpumask. Both (async and direct requests) can run
on a CPU not matching hctx->cpumask.

The CPU mask without disabling preemption and invoking
__blk_mq_run_hw_queue().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/YrLSEiNvagKJaDs5@linutronix.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index fa3dc4f8f35d04f86b5843ba5bf2eb813ba16bb4..62b7025d6854a90bb06c0303536bf1c6ec97a04e 100644 (file)
@@ -2085,14 +2085,10 @@ static void __blk_mq_delay_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async,
                return;
 
        if (!async && !(hctx->flags & BLK_MQ_F_BLOCKING)) {
-               int cpu = get_cpu();
-               if (cpumask_test_cpu(cpu, hctx->cpumask)) {
+               if (cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask)) {
                        __blk_mq_run_hw_queue(hctx);
-                       put_cpu();
                        return;
                }
-
-               put_cpu();
        }
 
        kblockd_mod_delayed_work_on(blk_mq_hctx_next_cpu(hctx), &hctx->run_work,