Re: [PATCH] RDMA/siw: Reuse value read using READ_ONCE instead of re-reading it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux