Re: [PATCH 1/6] sched/fair: Use guard(rcu) for sched_domain RCU sections

Andrea Righi
2026-04-28T14:26:22Z

Hi Steven,

On Tue, Apr 28, 2026 at 10:12:09AM -0400, Steven Rostedt wrote:
> On Tue, 28 Apr 2026 14:03:59 +0530
> K Prateek Nayak <kprateek.nayak@amd.com> wrote:
>
> > > - if (rq->nr_running >= 2) {
> > > - flags = NOHZ_STATS_KICK | NOHZ_BALANCE_KICK;
> > > - goto out;
> > > - }
> > > -
> > > - rcu_read_lock();
> > > + guard(rcu)();
> >
> > and since this is only called from:
> >
> > sched_tick() /* IRQs disabled */
> > sched_balance_trigger()
> > nohz_balancer_kick()
> >
> > with IRQs disabled, we can get rid of that rcu_read_lock() entirely.
>
> Then we need to add a lockdep_assert_irqs_disabled() here too.

Yeah, initially I suggested to add a lockdep_assert_irqs_disabled() in
nohz_balancer_kick() but what we care about here is RCU safety, if we do
something unsafe in the future we should be able to catch that with
rcu_dererference_all(), as pointed by Peter, right?

Thanks,
-Andrea