Thread (13 messages) 13 messages, 5 authors, 2025-07-22

Re: [PATCH] tracing: Remove pointless memory barriers

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2025-07-11 16:08:09
Also in: lkml

On Fri, 11 Jul 2025 09:29:46 +0100
David Laight [off-list ref] wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help