> "Drazen Kacar" wrote in message
> news:slrnm84di...@fly.srk.fer.hr...
> > Chris M. Thomasson wrote:
> > Comparing RCU read-side with anything that uses an atomic rmw and/or
> > memory barrier is just plain foolish. That LOCK ADD destroys
> > performance
> > when compared to RCU's basically zero overhead reads. End of story.
> I don't quite understand the "or" part of your "and/or memory barrier"
> statement. If there was a different algorithm which used only memory
> barrier, but not RMW, would that be so much worse than RCU?
Yes. Anytime you can reduce the number of memory barriers and/or
atomics, the better. I have tested RCU verses the same RCU with a single
MFENCE instruction on the reader side. The one without the membar
slaughtered it wrt reads-per-second per-thread.
> Another thing I don't quite understand is in Wikipedia's RCU article (at
>
http://en.wikipedia.org/wiki/Read-copy-update, section Simple
> implementation)
> The article says:
> [RCU's] read-side overhead is precisely zero, as
> smp_read_barrier_depends()
> is an empty macro on all but DEC Alpha CPUs;[19] such memory barriers
> are
> not needed on modern CPUs.
> I was under the impression that you'd need memory barrier on Alpha because
> it does more agressive memory access reordering than other processors.
> But then, if that's correct, that means that modern CPUs (whichever they
> are) still don't have features that old Alpha CPUs have. And not the other
> way round.
Yup. On a DEC Alpha, RCU simply needs a membar for it does not honor
data-dependent loads. RCU relies on data-dependences being there.