On Thu, Mar 15, 2018 at 09:12:09AM +0000, Alexey Brodkin wrote: > On Thu, 2018-03-15 at 09:18 +0100, Peter Zijlstra wrote: > > Also, it might make sense to stuff this implementation in some lib/ file > > somewhere and make all platforms that need it use the same code, afaict > > there really isn't anything platform specific to it. > > Not clear which part do you mean here. > Are you talking about entire cmpxchg syscall implementation? Yep. > Do you think there're many users of that quite an inefficient > [compared to proper HW version] atomic exchange? I think there's a bunch of architectures that are in the same boat. m68k, arm, mips was mentioned. Sure, the moment an arch has hardware support you don't need the syscall anymore. I was just thinking it would be good to have a common implementation (if possible) rather than 4-5 different copies of basically the same thing.