On Wed, Jan 16, 2019 at 07:51:41AM +1100, Dave Chinner wrote: > Atomic operations don't imply a memory barrier for dependent data, > right? Documentation/atomic_t.txt says: -------------------------- snip -------------------------- The rule of thumb: - non-RMW operations are unordered; - RMW operations that have no return value are unordered; - RMW operations that have a return value are fully ordered; [...] Fully ordered primitives are ordered against everything prior and everything subsequent. Therefore a fully ordered primitive is like having an smp_mb() before and an smp_mb() after the primitive. -------------------------- snip -------------------------- I think atomic_dec_and_test clearly falls into the third category, and I can't see how much of the kernel could work if that wasn't the case.