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

nicolas saenz julienne
2022-05-18T15:31:51Z

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.

Regards,

--
Nicolás Sáenz