[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_3F31ADAB6142D8948E5BD02B854ED2A77106@qq.com>
Date: Fri, 1 Mar 2024 13:37:18 +0800
From: linke <lilinke99@...com>
To: rostedt@...dmis.org
Cc: lilinke99@...com,
linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org,
mathieu.desnoyers@...icios.com,
mhiramat@...nel.org
Subject: Re: [PATCH] ring-buffer: use READ_ONCE() to read
cpu_buffer->commit_page in concurrent environment
> So basically you are worried about read-tearing?
>
> That wasn't mentioned in the change log.
Yes. Sorry for making this confused, I am not very familiar with this and
still learning.
> Funny part is, if the above timestamp read did a tear, then this would
> definitely not match, and would return the correct value. That is, the
> buffer is not empty because the only way for this to get corrupted is if
> something is in the process of writing to it.
I agree with you here.
commit = rb_page_commit(commit_page);
But if commit_page above is the result of a torn read, the commit field
read by rb_page_commit() may not represent a valid value.
In this case, READ_ONCE() is only needed for the commit_page.
Powered by blists - more mailing lists