On 2025-03-11 16:44:30 [+0100], Mateusz Guzik wrote: > On Fri, Feb 21, 2025 at 06:44:22PM -0800, Alexei Starovoitov wrote: > > +#define __localtry_lock(lock) \ > > + do { \ > > + localtry_lock_t *lt; \ > > + preempt_disable(); \ > > + lt = this_cpu_ptr(lock); \ > > + local_lock_acquire(<->llock); \ > > + WRITE_ONCE(lt->acquired, 1); \ > > + } while (0) > > I think these need compiler barriers. > > I checked with gcc docs (https://gcc.gnu.org/onlinedocs/gcc/Volatiles.html) > and found this as confirmation: > > Accesses to non-volatile objects are not ordered with respect to volatile accesses. > > Unless the Linux kernel is built with some magic to render this moot(?). You say we need a barrier() after the WRITE_ONCE()? If so, we need it in the whole file… Sebastian