Messages in this thread | | | Date | Sun, 10 Mar 2024 21:19:10 +0200 | From | Leon Romanovsky <> | 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
| |