[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250711120758.3f6904e9@batman.local.home>
Date: Fri, 11 Jul 2025 12:07:58 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: David Laight <david.laight.linux@...il.com>
Cc: Nam Cao <namcao@...utronix.de>, Gabriele Monaco <gmonaco@...hat.com>,
John Ogness <john.ogness@...utronix.de>, Masami Hiramatsu
<mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: Remove pointless memory barriers
On Fri, 11 Jul 2025 09:29:46 +0100
David Laight <david.laight.linux@...il.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
Powered by blists - more mailing lists