Re: [PATCH 21/21] rcu/context_tracking: Merge dynticks counter and context tracking states

Frederic Weisbecker
2022-05-19T15:06:55Z

On Wed, May 18, 2022 at 05:31:32PM +0200, nicolas saenz julienne wrote:
> On Tue, 2022-05-03 at 12:00 +0200, Frederic Weisbecker wrote:
>
> [...]
>
> > diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
> > index edd9f8f5b753..0841435620cf 100644
> > --- a/include/linux/context_tracking_state.h
> > +++ b/include/linux/context_tracking_state.h
> > @@ -10,12 +10,20 @@
> > #define DYNTICK_IRQ_NONIDLE ((LONG_MAX / 2) + 1)
> >
> > enum ctx_state {
> > - CONTEXT_DISABLED = -1, /* returned by ct_state() if unknown */
> > - CONTEXT_KERNEL = 0,
> > - CONTEXT_USER,
> > - CONTEXT_GUEST,
> > + CONTEXT_DISABLED = -1, /* returned by ct_state() if unknown */
> > + CONTEXT_KERNEL = 0,
> > + CONTEXT_IDLE = 1,
> > + CONTEXT_USER = 2,
> > + CONTEXT_GUEST = 3,
> > + CONTEXT_MAX = 4,
> > };
> >
> > +/* Even value for idle, else odd. */
> > +#define RCU_DYNTICKS_IDX CONTEXT_MAX
> > +
> > +#define CT_STATE_MASK (CONTEXT_MAX - 1)
> > +#define CT_DYNTICKS_MASK (~CT_STATE_MASK)
>
> Nit: These macros only work as long as we don't introduce new contexts. It's
> maybe worth a comment.

Ah good point, forgot that.

Thanks!