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

From: Uros Bizjak
Date: Thu Mar 06 2025 - 04:01:46 EST


On Wed, Mar 5, 2025 at 10:26 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 05, 2025 at 09:36:33PM +0100, Borislav Petkov wrote:
> > On Wed, Mar 05, 2025 at 09:54:11AM +0100, Uros Bizjak wrote:
> > > The -Os argument was to show the effect of the patch when the compiler
> > > is instructed to take care of the overall size. Giving the compiler
> > > -O2 and then looking at the overall size of the produced binary is
> > > just wrong.
> >
> > No one cares about -Os AFAICT. It might as well be non-existent. So the effect
> > doesn't matter.
>
> Well, more people would care if it didn't stand for -Ostupid I suppose.
> That is, traditionally GCC made some very questionable choices with -Os,
> quite horrendous code-gen.

Size optimizations result in 15% code size reduction (x86_64
defconfig, gcc-14.2), so they reflect what user wanted:

text data bss dec hex filename
27478996 4635807 814660 32929463 1f676b7 vmlinux-O2.o
23859143 4617419 814724 29291286 1bef316 vmlinux-Os.o

The compiler heuristics depend on tradeoffs, and -Os uses different
tradeoffs than -O2. Unfortunately, there is no
-Os-but-I-really-want-performace switch, but OTOH, tradeoffs can be
adjusted. The compiler is open-source, and these adjustments can be
discussed in public spaces (mailing lists and bugzilla) and eventually
re-tuned. We are aware that the world around us changes, so tunings
are not set in stone, but we also depend on user feedback.

Thanks,
Uros.