Re: RCU vs NOHZ

From: Paul E. McKenney
Date: Thu Sep 29 2022 - 15:52:54 EST


On Thu, Sep 29, 2022 at 09:01:46PM +0200, Peter Zijlstra wrote:
> On Thu, Sep 29, 2022 at 09:42:04AM -0700, Paul E. McKenney wrote:
> > On Thu, Sep 29, 2022 at 06:23:16PM +0200, Peter Zijlstra wrote:
> > > On Thu, Sep 29, 2022 at 08:46:18AM -0700, Paul E. McKenney wrote:
> > > > On Thu, Sep 29, 2022 at 08:20:44AM -0700, Paul E. McKenney wrote:
> > >
> > > > > > > There is a directly invoked RCU hook for any transition that enables or
> > > > > > > disables the tick, namely the ct_*_enter() and ct_*_exit() functions,
> > > > > > > that is, those functions formerly known as rcu_*_enter() and rcu_*_exit().
> > > > > >
> > > > > > Context tracking doesn't know about NOHZ, therefore RCU can't either.
> > > > > > Context tracking knows about IDLE, but not all IDLE is NOHZ-IDLE.
> > > > > >
> > > > > > Specifically we have:
> > > > > >
> > > > > > ct_{idle,irq,nmi,user,kernel}_enter()
> > > > > >
> > > > > > And none of them are related to NOHZ in the slightest. So no, RCU does
> > > > > > not have a NOHZ callback.
> > > > > >
> > > > > > I'm still thikning you're conflating NOHZ_FULL (stopping the tick when
> > > > > > in userspace) and regular NOHZ (stopping the tick when idle).
> > > >
> > > > Exactly how are ct_user_enter() and ct_user_exit() completely unrelated
> > > > to nohz_full CPUs?
> > >
> > > That's the thing; I'm not talking about nohz_full. I'm talking about
> > > regular nohz. World of difference there.
> >
> > And indeed, for !nohz_full CPUs, the tick continues throughout userspace
> > execution. But you really did have ct_user_enter() and ct_user_exit()
> > on your list.
> >
> > And for idle (as opposed to nohz_full userspace execution), there is still
> > ct_{idle,irq,nmi}_enter(). And RCU does pay attention to these.
> >
> > So exactly what are you trying to tell me here? ;-)
>
> That RCU doens't have a nohz callback -- you were arguing it does
> through the ct_*_enter() things, I said none of them are related to
> nohz.

OK, once again, I will bite...

How are ct_idle_enter(), ct_irq_enter() from idle, and ct_nmi_enter()
again from idle unrelated to nohz?

Or, for that matter, rcu_needs_cpu()?

Thanx, Paul