[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240310191910.GG12921@unreal>
Date: Sun, 10 Mar 2024 21:19:10 +0200
From: Leon Romanovsky <leon@...nel.org>
To: linke li <lilinke99@...com>
Cc: bmt@...ich.ibm.com, jgg@...pe.ca, linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org
Subject: Re: [PATCH] RDMA/siw: Reuse value read using READ_ONCE instead of
re-reading it
On Sun, Mar 10, 2024 at 08:15:25PM +0800, linke li wrote:
> I want to emphasize that if the value of orqe->flags has changed by the
> time of the second read, the value read will not satisfy the if condition,
> causing inconsistency. Given that there is already a READ_ONCE.
If value can change between subsequent reads, then you need to use locks
to make sure that it doesn't happen. Using READ_ONCE() doesn't solve the
concurrency issue, but makes sure that compiler doesn't reorder reads
and writes.
Thanks
Powered by blists - more mailing lists