Re: [PATCH 3/5] rcuwait: Introduce prepare_to and finish_rcuwait
From: Peter Zijlstra
Date: Thu Apr 23 2020 - 05:23:27 EST
On Tue, Apr 21, 2020 at 09:07:37PM -0700, Davidlohr Bueso wrote:
> +static inline void prepare_to_rcuwait(struct rcuwait *w)
> +{
> + rcu_assign_pointer(w->task, current);
> +}
> +
> +static inline void finish_rcuwait(struct rcuwait *w)
> +{
> + WRITE_ONCE(w->task, NULL);
I think that wants to be:
rcu_assign_pointer(w->task, NULL);
There is a special case in rcu_assign_pointer() that looses the barrier,
but it will keep the __rcu sparse people happy. That is w->task is
__rcu, and WRITE_ONCE ignores that etc.. blah.
The alternative is using RCU_INIT_POINTER() I suppose.
> + __set_current_state(TASK_RUNNING);
> +}