Re: [PATCH -tip] x86/locking/atomic: Use asm_inline for atomic locking insns

From: H. Peter Anvin
Date: Sat Mar 08 2025 - 14:15:37 EST


On 3/5/25 09:04, Linus Torvalds wrote:

That said, I do want to bring up another issue: maybe it's time to
just retire the LOCK_PREFIX thing entirely?

It harkens back to Ye Olde Days when UP was the norm, and we didn't
want to pay the cost of lock prefixes when the kernel was built for
SMP but was run on an UP machine.

And honestly, none of that makes sense any more. You can't buy a UP
machine any more, and the only UP case would be some silly minimal
virtual environment, and if people really care about that minimal
case, they should just compile the kernel without SMP support.
Becxause UP has gone from being the default to being irrelevant. At
least for x86-64.


I think the key there is that "they should just compile the kernel without SMP support" (which may very well make sense for some oddball embedded uses) *does* still mean that remaining cases of locks can/should be elided so demacroizing it is still not an option.

But yes... would get rid of a lot of crap machinery which is basically dead code, and that would be a Very Good Thing[TM].

-hpa