[PATCH] Document Linux's memory barriers

Alan Cox alan at lxorguk.ukuu.org.uk
Thu Mar 9 23:28:59 EST 2006


On Iau, 2006-03-09 at 11:41 +0000, David Howells wrote:
> Alan Cox <alan at lxorguk.ukuu.org.uk> wrote:
> So, you're saying that the LOCK and UNLOCK primitives don't actually modify
> memory, but rather simply pin the cacheline into the CPU's cache and refuse to
> let anyone else touch it?

Basically yes

> No... it can't work like that. It *must* make a memory modification 

Then you'll have to argue with the chip designers because it doesn't.

Its all built around the cache coherency. To make a write to a cache
line I must be the sole owner of the line. Look up "MESI cache" in a
good book on the subject.

If we own the affected line then we can update just the cache and be
sure that since we own the cache line and we will write it back if
anyone else asks for it (or nowdays on some systems transfer it direct
to the other cpu) that we get locked semantics




More information about the Linuxppc64-dev mailing list