On Fri, 11 Jul 2025 09:29:46 +0100 David Laight <david.laight.li...@gmail.com> wrote:
> > Doesn't atomic make sure the values are seen when they are changed? > > No. > It normally just ensures the read/write aren't 'torn'. > Atomics are used for read-modify-writes to ensure two cpu don't > do read-read-modify-modify-write-write losing one of the changes. > (They can need special instructions for read and write - but normally don't.) > So here just the same as the volatile accesses READ_ONCE() and WRITE_ONCE(). At first I was about to say "But wait! I rely on this to work in other parts of my code", but then realized I use atomic_inc_return() and similar that actually do make the update atomic across CPUs. -- Steve