From: Uros Bizjak > Sent: 06 April 2023 09:39 > > On Thu, Apr 6, 2023 at 10:26 AM David Laight <David.Laight@xxxxxxxxxx> wrote: > > > > From: Dave Hansen > > > Sent: 05 April 2023 17:37 > > > > > > On 4/5/23 07:17, Uros Bizjak wrote: > > > > Add generic and target specific support for local{,64}_try_cmpxchg > > > > and wire up support for all targets that use local_t infrastructure. > > > > > > I feel like I'm missing some context. > > > > > > What are the actual end user visible effects of this series? Is there a > > > measurable decrease in perf overhead? Why go to all this trouble for > > > perf? Who else will use local_try_cmpxchg()? > > > > I'm assuming the local_xxx operations only have to be save wrt interrupts? > > On x86 it is possible that an alternate instruction sequence > > that doesn't use a locked instruction may actually be faster! > > Please note that "local" functions do not use lock prefix. Only atomic > properties of cmpxchg instruction are exploited since it only needs to > be safe wrt interrupts. Gah, I was assuming that LOCK was implied - like it is for xchg and all the bit instructions. In any case I suspect it makes little difference unless the locked variant affects the instruction pipeline. In fact, you may want to stop the cacheline being invalidated between the read and write in order to avoid an extra cache line bounce. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)