[PATCH] futex: Optimise the size check get_futex_key()

Peter Zijlstra peterz at infradead.org
Thu Jul 2 04:18:07 PDT 2026


On Thu, Jul 02, 2026 at 12:56:15PM +0200, Sebastian Andrzej Siewior wrote:
> On 2026-07-02 10:59:21 [+0200], Peter Zijlstra wrote:
> > > Could someone verify this, please? The 5% look a bit high. This is on
> > > top of the series (but not worsen by the series).
> > 
> > Bah, I tried to reproduce and couldn't. Then I noticed I did a clang
> > build and that is in fact clever enough to do this optimization itself.
> > 
> > /me tries again with a GCC build.
> > 
> > pre:  [thread  0] futex: 0x561f14430680 [ 9021408 ops/sec ]
> > post: [thread  0] futex: 0x55feadbbb680 [ 8977527 ops/sec ]
> > 
> > (and this seems to be well inside the error threshold of this test).
> > 
> > So I see the GCC build do the DIV, and no longer with his patch applied,
> > but for some reason I cannot get the runtime performance to actually
> > improve much of anything on my system.
> 
> I did open https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126078 for the
> div.
> 
> My .config is the debian distro on the 4 node big iron. [ in case it
> it has so much overhead elsewhere that this place a bigger role].
> 
> "perf top" showed this as 6% or something and red in the function. After
> the removal it did not show up.

Right, I build whatever random config I had on the SPR test box. But I
can't argue with the patch, it is sane and GCC does generate better code
with it. For $raisins it just didn't translate into actual performance
for me.



More information about the linux-arm-kernel mailing list