[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150715181511.GT19282@twins.programming.kicks-ass.net>
Date: Wed, 15 Jul 2015 20:15:11 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Daniel Wagner <daniel.wagner@...-carit.de>,
Davidlohr Bueso <dave@...olabs.net>,
Ingo Molnar <mingo@...hat.com>, Tejun Heo <tj@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] rcu: Create rcu_sync infrastructure
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists