diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2020-12-04 20:13:54 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-12-17 13:41:30 -0700 |
commit | 71425189b2b75336d869cfdedea45c9d319fc9c9 (patch) | |
tree | f6bdd8e4284ddceac8deb41eba2896bb32093870 | |
parent | 53a7f655834c7c335bf683f248208d4fbe4b47bc (diff) | |
download | linux-71425189b2b75336d869cfdedea45c9d319fc9c9.tar.bz2 |
blk-mq: Don't complete on a remote CPU in force threaded mode
With force threaded interrupts enabled, raising softirq from an SMP
function call will always result in waking the ksoftirqd thread. This is
not optimal given that the thread runs at SCHED_OTHER priority.
Completing the request in hard IRQ-context on PREEMPT_RT (which enforces
the force threaded mode) is bad because the completion handler may
acquire sleeping locks which violate the locking context.
Disable request completing on a remote CPU in force threaded mode.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-mq.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index a428798e1c5c..c338c9bc5a2c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -650,6 +650,14 @@ static inline bool blk_mq_complete_need_ipi(struct request *rq) if (!IS_ENABLED(CONFIG_SMP) || !test_bit(QUEUE_FLAG_SAME_COMP, &rq->q->queue_flags)) return false; + /* + * With force threaded interrupts enabled, raising softirq from an SMP + * function call will always result in waking the ksoftirqd thread. + * This is probably worse than completing the request on a different + * cache domain. + */ + if (force_irqthreads) + return false; /* same CPU or cache domain? Complete locally */ if (cpu == rq->mq_ctx->cpu || |