On Fri Jan 13, 2023 at 2:15 PM AEST, Linus Torvalds wrote: > On Thu, Jan 12, 2023 at 9:20 PM Nicholas Piggin <npiggin@xxxxxxxxx> wrote: > > > > Actually what we'd really want is an arch specific implementation of > > lockref. > > The problem is mainly that then you need to generate the asm versions > of all those different CMPXCHG_LOOP() variants. > > They are all fairly simple, though, and it woudln't be hard to make > the current lib/lockref.c just be the generic fallback if you don't > have an arch-specific one. Yeah, it doesn't look too onerous so it's probably worth seeing what the code and some numbers look like here. > And even if you do have the arch-specific LL/SC version, you'd still > want the generic fallback for the case where a spinlock isn't a single > word any more (which happens when the spinlock debugging options are > on). You're right, good point. Thanks, Nick