On Thu, Oct 03, 2019 at 06:33:15AM -0700, Paul E. McKenney wrote:
> On Thu, Oct 03, 2019 at 09:08:50AM -0400, Steven Rostedt wrote:
> > On Thu, 03 Oct 2019 09:39:17 +0100
> > David Howells <dhowe...@redhat.com> wrote:
> > 
> > > paul...@kernel.org wrote:
> > > 
> > > > +#define rcu_replace(rcu_ptr, ptr, c)                                   
> > > > \
> > > > +({                                                                     
> > > > \
> > > > +       typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c));  
> > > > \
> > > > +       rcu_assign_pointer((rcu_ptr), (ptr));                           
> > > > \
> > > > +       __tmp;                                                          
> > > > \
> > > > +})  
> > > 
> > > Does it make sense to actually use xchg() if that's supported by the arch?
> 
> Historically, xchg() has been quite a bit slower than a pair of assignment
> statements, in part due to the strong memory ordering guaranteed by
> xchg().  Has that changed?  If so, then, agreed, it might make sense to
> use xchg().

For the kfree_rcu() performance testing I was working on recently, replacing
xchg() with a pair of assignment statements in the code being tested provided
a great performance increase (on x86).

thanks,

 - Joel

Reply via email to