Re: [PATCH] sched/fair: Prefer fully idle cores for NOHZ balancing

From: Andrea Righi

Date: Wed Jul 29 2026 - 10:46:51 EST


On Wed, Jul 29, 2026 at 04:09:05PM +0530, K Prateek Nayak wrote:
...
> >> It is safe to use "select_rq_mask" here since this is the tick handler
> >> trying to find an ilb_cpu and "select_rq_mask" is only used in contexts
> >> with IRQs disabled. It can probably be renamed to suggest that it is
> >> safe to be used in any IRQ disabled context as a temporary mask.
> >>
> >> Thoughts?
> >
> > Agreed. We can also add lockdep_assert_irqs_disabled() to find_new_ilb() to
> > better document and verify the condition that makes reusing select_rq_mask safe.
>
> That works too but it just looks a bot odd to have the selectrq_mask in
> a load balancing function.

Ack.

>
> >
> > Speaking of that, instead of renaming it, would it be better to provide a helper
> > to access select_rq_mask with lockdep_assert_irqs_disabled()?
>
> I'll defer to Peter on that :-)
>
> He had previously suggested renaming it when there were discussions to
> reuse it here
> https://lore.kernel.org/lkml/20260320114312.GB3558198@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/

Thanks for the pointer! Looking at that discussion, this seems broader than a
simple mechanical rename and it doesn't appear to have converged on a concrete
interface. It looks like a useful but independent scheduler cleanup and I'd
prefer not to make it a prerequisite for this.

Maybe for v2 I can keep the existing select_rq_mask, add
lockdep_assert_irqs_disabled() and implement your suggestion. Results are
looking good so far on my side with your change.

Peter, do you have a preference on whether the mask renaming/accessor work
should be addressed separately, or included as a preparatory patch for this?

Thanks,
-Andrea