On Thu, 2010-09-16 at 12:55 +0100, David Howells wrote: > If there's a lock+unlock between, then this counts as a full memory > barrier I though it was unlock+lock. >From memory-barriers.txt: And a couple of implicit varieties: (5) LOCK operations. This acts as a one-way permeable barrier. It guarantees that all memory operations after the LOCK operation will appear to happen after the LOCK operation with respect to the other components of the system. Memory operations that occur before a LOCK operation may appear to happen after it completes. A LOCK operation should almost always be paired with an UNLOCK operation. (6) UNLOCK operations. This also acts as a one-way permeable barrier. It guarantees that all memory operations before the UNLOCK operation will appear to happen before the UNLOCK operation with respect to the other components of the system. Memory operations that occur after an UNLOCK operation may appear to happen before it completes. LOCK and UNLOCK operations are guaranteed to appear with respect to each other strictly in the order specified. The use of LOCK and UNLOCK operations generally precludes the need for other sorts of memory barrier (but note the exceptions mentioned in the subsection "MMIO write barrier"). Therefore: A = 5 LOCK UNLOCK B = 6 May be observed as: LOCK B = 6 A = 5 UNLOCK The sequence: A = 5 UNLOCK LOCK B = 6 Is fully ordered. -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html