[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250709110827.0dce4012@batman.local.home>
Date: Wed, 9 Jul 2025 11:08:27 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Nam Cao <namcao@...utronix.de>
Cc: 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 Tue, 8 Jul 2025 09:42:19 +0200
Nam Cao <namcao@...utronix.de> wrote:
> So yes, smp_rmb() is only useful inbetween reads, and smp_wmb() is
> only userful inbetween writes.
Hmm, I wonder if barriers isn't needed but atomic values are?
That is, it looks like rv_monitoring_on() is looking to read the
current state, where as turn_monitoring_on/off() changes the state.
Perhaps instead of barriers, it should use atomics?
bool rv_monitoring_on(void)
{
return atomic_read(&monitoring_on);
}
static void turn_monitoring_off(void)
{
atomic_set(&monitoring_on, 0);
}
Doesn't atomic make sure the values are seen when they are changed?
As this code is more about looking at state and not ordering, and I
think that's what atomics are about.
-- Steve
Powered by blists - more mailing lists