Re: [PATCH tip/core/rcu 08/10] rcu: Add a TINY_PREEMPT_RCU

From: Paul E. McKenney
Date: Tue Aug 17 2010 - 15:34:11 EST


On Tue, Aug 17, 2010 at 12:25:25PM -0400, Mathieu Desnoyers wrote:
> * Steven Rostedt (rostedt@xxxxxxxxxxx) wrote:
> > On Tue, 2010-08-17 at 12:04 -0400, Steven Rostedt wrote:
> >
> > > > Then we could go for the simpler:
> > > >
> > > > --t->rcu_read_lock_nesting;
> > > > barrier();
> > > > if (t->rcu_read_lock_nesting == 0 &&
> > > > unlikely((t->rcu_read_unlock_special))
> > >
> > > Yeah, that's what I meant, I was too lazy to remove the ACCESS_ONCE()
> > > from the cut and paste I did.
> > >
> > > >
> > > > Which puts a constraint across all memory accesses. I'd be fine with
> > > > that if you are afraid of too much micro-optimization (e.g. my
> > > > barrier2(a, b) proposal).
> > >
> > > Not afraid, but just too much code for a simple solution.
> >
> > IOW,
> >
> > I think just pulling out the '--' and adding the barrier() is the proper
> > solution here. Compiler barriers are rather cheap.
> >
> > Can we all agree on this solution?
>
> Given that we already have a barrier() at the beginning of
> rcu_read_unlock(), adding a second one will not have much more global
> optimisation impact than what is already there. I'm personally fine with
> this solution. Let's see what others have to say about this.

Thank you both for the optimization work -- the read-side primitives do
need to be fast. And the barrier() approach generates decent code, on
some systems better than the original. So the second barrier wins. ;-)

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