Re: [PATCH v5] blk-mq: dispatch kworker to housekeeping CPU when hctx cpumask is empty
From: Aaron Tomlin
Date: Tue Nov 24 2026 - 16:04:11 EST
On Mon, Nov 23, 2026 at 11:47:47AM +0100, Marco Crivellari wrote:
> Hi Aaron,
Hi Marco,
>
> On Sun, Nov 22, 2026 at 12:52 AM Aaron Tomlin <atomlin@xxxxxxxxxxx> wrote:
> >
> > [...] In real-time environments, an active SCHED_FIFO workload will
> > starve this SCHED_NORMAL worker and stall hardware dispatch, whilst also
> > introducing unwanted latency jitter on nohz_full cores, defeating that
> > commit's original objective.
>
> I would phrase this differently. cpu_is_isolated() checks HK_TYPE_DOMAIN,
> so the jitter argument holds only when the nohz_full CPU is also
> domain isolated (isolcpus=domain or an isolated cpuset partition). With
> nohz_full alone, or isolcpus=nohz without domain, this patch does not
> apply and the behavior is unchanged.
Agreed, that distinction is much clearer. Since both commit a46c27026da1
and blk_mq_hctx_unbound_cpu() test cpu_is_isolated() (HK_TYPE_DOMAIN), CPUs
configured solely with nohz_full= or isolcpus=nohz without domain isolation
(or an isolated cpuset partition) remain unaffected. I will reword the
commit log in the next iteration to clarify that this applies specifically
to domain-isolated CPUs (including when combined with nohz_full).
>
> > +static inline int blk_mq_hctx_unbound_cpu(void)
> > +{
> > +#ifdef CONFIG_CPU_ISOLATION
> > + if (static_branch_unlikely(&housekeeping_overridden)) {
> > + int cpu;
> > +
> > + guard(preempt)();
> > + if (!cpu_is_isolated(raw_smp_processor_id()))
> > + return WORK_CPU_UNBOUND;
>
> Since preemption is disabled by guard(preempt)(), you can use
> smp_processor_id() here instead of raw_smp_processor_id().
Oops! raw_smp_processor_id() was a leftover from v4 before guard(preempt)()
was moved ahead of cpu_is_isolated(). I will switch to smp_processor_id()
in the next iteration.
Thank you for the review!
Kind regards,
--
Aaron Tomlin