On Fri, 23 Aug 2024 at 11:05, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > Looking around, we do seem to have a pattern of > > smp_store_release() -> wake_up_var() > > instead of a memory barrier. I don't think that actually works. Hmm. It might not work for the wakeup race, but it might be a good idea to do the store_release anyway, just for the actual user (ie then the *use* of the variable may start with a "smp_load_acquire()", and the release->acquire semantics means that everything that was done before the release is visible after the acquire. Of course, the smp_mb() will force that ordering too, but for a true concurrent user that doesn't actually need waking up, it might see the newly stores var value before the smp_mb() happens on the generating side. End result: those code paths may want *both* the smp_store_release() and the smp_mb(), because they are ordering different accesses. Just goes to show that this whole thing is more complicated than just "wait for a value". Linus