lkml.org 
[lkml]   [2015]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/7] rcu: Create rcu_sync infrastructure
On Wed, Jul 15, 2015 at 08:15:11PM +0200, Peter Zijlstra wrote:
> On Wed, Jul 15, 2015 at 11:05:46AM -0700, Paul E. McKenney wrote:
> > On Sun, Jul 12, 2015 at 01:35:48AM +0200, Oleg Nesterov wrote:
> > > It is functionally equivalent to
> > >
> > > struct rcu_sync_struct {
> > > atomic_t counter;
> > > };
> > >
> > > static inline bool rcu_sync_is_idle(struct rcu_sync_struct *rss)
> > > {
> >
> > If you add an smp_mb() here...
> >
> > > return atomic_read(&rss->counter) == 0;
> > > }
> > >
> > > static inline void rcu_sync_enter(struct rcu_sync_struct *rss)
> > > {
> > > atomic_inc(&rss->counter);
> > > synchronize_sched();
> > > }
> > >
> > > static inline void rcu_sync_exit(struct rcu_sync_struct *rss)
> > > {
> > > synchronize_sched();
> >
> > You should be able to demote the above synchronize_sched() to an
> > smp_mb__before_atomic(). Even rare writes should make this tradeoff
> > worthwhile.
>
> No, it makes the read-side primitive contain an unconditional memory
> barrier, that forgoes the entire point.
>
> The writers are stupidly expensive already for they need global
> serialization, optimizing them in any way doesn't make sense.

That could well be the case, but it would be good to see the numbers.

Thanx, Paul



\
 
 \ /
  Last update: 2015-07-15 20:41    [W:0.057 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site