On Wed, 19 Feb 2025 21:15:08 -0500 Waiman Long <llong@xxxxxxxxxx> wrote: > Writer - setting them: > > WRITE_ONCE(lock) > smp_wmb() > WRITE_ONCE(type) > > Clearing them: > > WRITE_ONCE(type, 0) > smp_wmb() > WRITE_ONCE(lock, NULL) > > Reader: > > READ_ONCE(type) > again: > smp_rmb() > READ_ONCE(lock) > smp_rmb() > if (READ_ONCE(type) != type) > goto again Do you really need the READ/WRITE_ONCE() with the memory barriers? From what I understand, the compiler can't even assume what it read is the same after passing a memory barrier like that. So there should be no reason it can reread the memory location after a barrier. -- Steve