Re: [patch 03/63] sched: Prepare for RT sleeping spin/rwlocks

From: Mike Galbraith
Date: Sun Aug 01 2021 - 11:31:04 EST


On Fri, 2021-07-30 at 15:50 +0200, Thomas Gleixner wrote:
>
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -155,6 +155,27 @@ struct task_group;
>                 WRITE_ONCE(current->__state, (state_value));            \
>                 raw_spin_unlock_irqrestore(&current->pi_lock, flags);   \
>         } while (0)
> +
> +
> +#define current_save_and_set_rtlock_wait_state()                       \
> +       do {                                                            \
> +               raw_spin_lock(&current->pi_lock);                       \
> +               current->saved_state = current->__state;                \
^^should that be using READ_ONCE()?

> +#define current_save_and_set_rtlock_wait_state()                       \
> +       do {                                                            \
> +               raw_spin_lock(&current->pi_lock);                       \
> +               current->saved_state = current->__state;                \
^^ditto?