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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to