Re: [PATCH -tip] x86/locking/atomic: Use asm_inline for atomic locking insns
From: Ingo Molnar
Date: Wed Mar 05 2025 - 14:56:10 EST
* Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
> On Sat, Mar 1, 2025 at 1:38 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
> >
> > On Sat, Mar 01, 2025 at 10:05:56AM +0100, Uros Bizjak wrote:
> > > OTOH, -Os, where different code size/performance heuristics are used, now
> > > performs better w.r.t code size.
> >
> > Did anything change since:
> >
> > 281dc5c5ec0f ("Give up on pushing CC_OPTIMIZE_FOR_SIZE")
> > 3a55fb0d9fe8 ("Tell the world we gave up on pushing CC_OPTIMIZE_FOR_SIZE")
> >
> > wrt -Os?
> >
> > Because if not, we still don't love -Os and you can drop the -Os argument.
>
> 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.
>
> > And without any perf data showing any improvement, this patch does nothing but
> > enlarge -O2 size...
>
> Even to my surprise, the patch has some noticeable effects on the
> performance, please see the attachment in [1] for LMBench data or [2]
> for some excerpts from the data. So, I think the patch has potential
> to improve the performance.
>
> [1] https://lore.kernel.org/lkml/CAFULd4YBcG45bigHBox2pu+To+Y5BzbRxG+pUr42AVOWSnfKsg@xxxxxxxxxxxxxx/
> [2] https://lore.kernel.org/lkml/CAFULd4ZsSKwJ4Dz3cCAgaVsa4ypbb0e2savO-3_Ltbs=1wzgKQ@xxxxxxxxxxxxxx/
If you are measuring micro-costs, please make sure you pin the workload
to a single CPU (via 'taskset' for example) and run 'perf stat --null
--repeat 5' or so to measure the run-over-run noise of the benchmark.
Thanks,
Ingo