[PATCH v2] blk-mq: use a housekeeping CPU for passthrough requests on isolated hctxs
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Tue Nov 3 08:37:48 PST 2026
On 2026-11-03 15:57:22 [+0100], Daniel Wagner wrote:
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -717,6 +717,25 @@ struct request *blk_mq_alloc_request(struct request_queue *q, blk_opf_t opf,
> }
> EXPORT_SYMBOL(blk_mq_alloc_request);
>
> +/*
> + * Return an online CPU which is neither isolated from the scheduler domains
> + * nor from managed interrupts, or nr_cpu_ids if there is none.
> + */
> +static unsigned int blk_mq_housekeeping_cpu(void)
> +{
> + unsigned int cpu;
> +
> + rcu_read_lock();
> + for_each_online_cpu(cpu) {
> + if (!cpu_is_isolated(cpu) &&
> + housekeeping_test_cpu(cpu, HK_TYPE_MANAGED_IRQ))
> + break;
> + }
What about
guard(rcu);
for_each_cpu_and(cpu, cpu_online_mask, housekeeping_cpumask(HK_TYPE_MANAGED_IRQ)) {
if (!cpu_is_isolated(cpu)
break;
}
this ends up with one less function call ;)
> + rcu_read_unlock();
> +
> + return cpu;
> +}
> +
> struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
> blk_opf_t opf, blk_mq_req_flags_t flags, unsigned int hctx_idx)
> {
Reviewed-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
Sebastian
More information about the Linux-nvme
mailing list