Re: What does atomic_read actually do?

From: Arjan van de Ven
Date: Sat Dec 18 2004 - 13:35:44 EST

On Sat, 2004-12-18 at 11:23 -0500, Joseph Seigh wrote:
> It doesn't do anything that would actually guarantee that the fetch from
> memory would be atomic as far as I can see, at least in the x86 version.

define atomic....

what linux atomics guarantee you is that you either "see" the old or the
new value if you use atomic_* as the sole accessor API, with the
footnote that this only holds if you don't forcefully misalign the

if you want ordering guarantees on top... you need to use explicit
bariers for that (wmb/rmb and friends).

For the "no inbetween" rule, doing the read the way x86 does works on
x86, since x86 makes sure that on the write side, no intermediate
results become visible.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at