On Tue, Sep 03, 2019 at 09:41:17AM +0200, Peter Zijlstra wrote:
> On Mon, Sep 02, 2019 at 11:52:01PM -0500, Eric W. Biederman wrote:
> 
> > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > index 2b037f195473..802958407369 100644
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> 
> > @@ -3857,7 +3857,7 @@ static void __sched notrace __schedule(bool preempt)
> >  
> >     if (likely(prev != next)) {
> >             rq->nr_switches++;
> > -           rq->curr = next;
> > +           rcu_assign_pointer(rq->curr, next);
> >             /*
> >              * The membarrier system call requires each architecture
> >              * to have a full memory barrier after updating
> 
> This one is sad; it puts a (potentially) expensive barrier in here. And
> I'm not sure I can explain the need for it. That is, we've not changed
> @next before this and don't need to 'publish' it as such.
> 
> Can we use RCU_INIT_POINTER() or simply WRITE_ONCE(), here?

That is, I'm thinking we qualify for point 3 (both a and b) of
RCU_INIT_POINTER().

Reply via email to