[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_688B20450ABBA409637C5A4BC3A7B0191D07@qq.com>
Date: Sun, 10 Mar 2024 20:36:34 +0800
From: linke li <lilinke99@...com>
To: yanjun.zhu@...ux.dev
Cc: bmt@...ich.ibm.com,
jgg@...pe.ca,
leon@...nel.org,
lilinke99@...com,
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
> In a complicated environment, for example, this function is called many
> times at the same time and orqe->flags is changed at the same time, I am
> not sure if this will introduce risks or not.
I think one function of READ_ONCE is to read a valid value while the value
may change concurrently. And there is a smp() above the READ_ONCE, which
means that the READ_ONCE is well ordered. I think it is kind of safe here.
> if you need to ensure the consistency of the flags throughout the function, not sure if the following is better or not.
> if (((orqe_flags=READ_ONCE(orqe->flags))) & SIW_WQE_VALID) {
This patch looks like exactly do the same things. The only difference I
think is the code style.
Thanks,
Linke
Powered by blists - more mailing lists