Re: [PATCH] seqlock: Use WRITE_ONCE() on sequence update

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

 



Hi Akira,

Thanks for taking a look!

On Tue, Dec 17, 2024, at 5:53 PM, Akira Yokosawa wrote:
> Hello,
>
> Daniel Xu wrote:
>> WRITE_ONCE() is needed here to prevent store tears and other unwanted
>> compiler optimizations.
>
> That might be true if there were chances of these two accesses to
> race with each other.
>
> I don't see any possibility of such races.
>
> Can you elaborate?

My understanding is that read_seqbegin() and read_seqretry()
can execute at any time. That means the read side access of
the sequence number can occur doing an increment.

To prevent the reader from reading a partially written value,
we need the WRITE_ONCE() to ensure the relaxed atomic
write.

Thanks,
Daniel




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux