Re: [RFC PATCH 11/14] context-tracking: Introduce work deferral infrastructure

Frederic Weisbecker
2023-07-06T10:02:01Z

On Thu, Jul 06, 2023 at 12:23:57AM +0200, Frederic Weisbecker wrote:
> diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
> index fdd537ea513f..ec3d172601c5 100644
> --- a/include/linux/context_tracking_state.h
> +++ b/include/linux/context_tracking_state.h
> @@ -10,14 +10,19 @@
> #define DYNTICK_IRQ_NONIDLE ((LONG_MAX / 2) + 1)
>
> enum ctx_state {
> + /* Following are values */
> CONTEXT_DISABLED = -1, /* returned by ct_state() if unknown */
> CONTEXT_KERNEL = 0,
> CONTEXT_IDLE = 1,
> CONTEXT_USER = 2,
> - CONTEXT_GUEST = 3,
> - CONTEXT_MAX = 4,
> + /* Following are bit numbers */
> + CONTEXT_WORK = 2,
> + CONTEXT_MAX = 16,
> };
>
> +#define CONTEXT_MASK (BIT(CONTEXT_WORK) - 1)
> +#define CONTEXT_WORK_MASK ((BIT(CONTEXT_MAX) - 1) & ~(BIT(CONTEXT_WORK) - 1))
> +
> /* Even value for idle, else odd. */
> #define RCU_DYNTICKS_IDX CONTEXT_MAX

And that should be:

#define RCU_DYNTICKS_IDX BIT(CONTEXT_MAX)

Did I mention it's not even build tested? :o)