Re: [patch 05/50] sched: Provide schedule point for RT locks

From: Peter Zijlstra
Date: Wed Jul 14 2021 - 04:28:44 EST


On Tue, Jul 13, 2021 at 05:10:59PM +0200, Thomas Gleixner wrote:

> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5832,8 +5832,14 @@ pick_next_task(struct rq *rq, struct tas
> */
> #define SM_NONE 0x0
> #define SM_PREEMPT 0x1
> -#define SM_MASK_PREEMPT UINT_MAX
> -#define SM_MASK_STATE SM_MASK_PREEMPT
> +#ifndef CONFIG_PREEMPT_RT
> +# define SM_MASK_PREEMPT UINT_MAX
> +# define SM_MASK_STATE SM_MASK_PREEMPT
> +#else
> +# define SM_RTLOCK_WAIT 0x2
> +# define SM_MASK_PREEMPT SM_PREEMPT
> +# define SM_MASK_STATE (SM_PREEMPT | SM_RTLOCK_WAIT)
> +#endif

Wouldn't something like this:


#ifndef CONFIG_PREEMPT_RT
# define SM_MASK_PREEMPT (~0U)
#else
# define SM_RTLOCK_WAIT 0x2
# define SM_MASK_PREEMPT SM_PREEMPT
#endif

#define SM_MASK_STATE (~0U)

Be even better?