[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_9882B228F292088CDD68F10CF1C228742009@qq.com>
Date: Tue, 5 Mar 2024 14:24:20 +0800
From: linke li <lilinke99@...com>
To: joel@...lfernandes.org
Cc: boqun.feng@...il.com,
dave@...olabs.net,
frederic@...nel.org,
jiangshanlai@...il.com,
josh@...htriplett.org,
lilinke99@...com,
linux-kernel@...r.kernel.org,
mathieu.desnoyers@...icios.com,
paulmck@...nel.org,
qiang.zhang1211@...il.com,
quic_neeraju@...cinc.com,
rcu@...r.kernel.org,
rostedt@...dmis.org
Subject: Re: [PATCH] rcutorture: Fix rcu_torture_pipe_update_one()/rcu_torture_writer() data race and concurrency bug
> Anyway, a slightly related/different question:
>
> Should that:
> WRITE_ONCE(rp->rtort_pipe_count, rp->rtort_pipe_count + 1);
>
> Be:
> WRITE_ONCE(rp->rtort_pipe_count, READ_ONCE(rp->rtort_pipe_count) + 1);
>
> ?
Hi, Joel. Sorry, I am not very sure about this. I do a little research on
it.
I looked through all code in kernel that looks like this, both kinds are
used. I also try to compile this file with and without the READ_ONCE in
WRITE_ONCE using gcc-9. Their binary is just the same.
Thus I think in the current compiler version, they do not have a big
difference, but if the compiler wants to optimize more, maybe the latter
one is better.
Powered by blists - more mailing lists