On Sun, Sep 19, 2021 at 11:28 AM Thomas Gleixner wrote: > > > - atomic_add(READER_BIAS - bias, &rwb->readers); > + /* > + * _release() is needed in case that reader is in fast path, pairing > + * with atomic_try_cmpxchg() in rwbase_read_trylock(), provides RELEASE > + */ > + (void)atomic_add_return_release(READER_BIAS - bias, &rwb->readers); Ugh. This really needs fixing. atomic_add() is already much more than release-ordered on x86, and atomic_add_return_release() is much more expensive on some uarchs. I think it should be easy to add a atomic_add_release() function, and it might be as simple as the attached patch, allowing architectures to add their own arch_atomic_add_release() as needed. I've pulled this, but please don't do things like the above hack. Linus