[Linux-kernel-mentees] [PATCH 2/2] events: callchain: Use RCU API to access RCU pointer

Peter Zijlstra peterz at infradead.org
Thu Jan 30 13:32:48 UTC 2020


On Thu, Jan 30, 2020 at 03:44:51PM +0530, Amol Grover wrote:
> > > > diff --git a/kernel/events/callchain.c b/kernel/events/callchain.c
> > > > index f91e1f41d25d..a672d02a1b3a 100644
> > > > --- a/kernel/events/callchain.c
> > > > +++ b/kernel/events/callchain.c
> > > > @@ -62,7 +62,8 @@ static void release_callchain_buffers(void)
> > > >  {
> > > >  	struct callchain_cpus_entries *entries;
> > > >  
> > > > -	entries = callchain_cpus_entries;
> > > > +	entries = rcu_dereference_protected(callchain_cpus_entries,
> > > > +					    lockdep_is_held(&callchain_mutex));
> > > 
> > > 
> > > Reviewed-by: Joel Fernandes (Google) <joel at joelfernandes.org>
> > 
> > Do we really need that smp_read_barrier_depends() here? Then again, I
> > don't suppose this is a fast path.
> > 
> 
> rcu_dereference_protected is actually a lightweight API and IIRC it
> omits the READ_ONCE() and hence the memory barriers.

Oh argh, indeed. I suppose I should've had more tea this morning.


More information about the Linux-kernel-mentees mailing list