[PATCH v5 8/8] futex: Use runtime constants for __futex_hash() hot path
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Wed Jul 1 04:01:39 PDT 2026
On 2026-07-01 10:41:55 [+0200], To Peter Zijlstra wrote:
> This makes it go away at no extra price but yeah let me boot a big box
> and see.
as-is:
|$ ./perf bench futex hash -f 1 -t 1 -r 10 -b 0
| # Running 'futex/hash' benchmark:
| Run summary [PID 3588]: 1 threads, each operating on 1 [private] futexes for 10 secs.
|
| [thread 0] futex: 0x5555e5ad4740 [ 6449632 ops/sec ]
|
| Averaged 6449632 operations/sec (+- 0,00%), total secs = 10
| Futex hashing: global hash
roughly that area, repeated runs usually change the last three digits.
Patched:
| $ ./perf bench futex hash -f 1 -t 1 -r 10 -b 0
| # Running 'futex/hash' benchmark:
| Run summary [PID 2375]: 1 threads, each operating on 1 [private] futexes for 10 secs.
|
| [thread 0] futex: 0x5585ddebd740 [ 6532004 ops/sec ]
|
| Averaged 6532004 operations/sec (+- 0,00%), total secs = 10
| Futex hashing: global hash
for private hash there is change within the noise area for -b 8192.
So we have here +1.28% ops/sec. Not ground breaking, not bad either.
With more threads:
| $ ./perf bench futex hash -r 30 -b 0
| # Running 'futex/hash' benchmark:
| Run summary [PID 2424]: 144 threads, each operating on 1024 [private] futexes for 30 secs.
|
| [thread 0] futexes: 0x556f3a3387c0 ... 0x556f3a3397bc [ 2104422 ops/sec ]
…
| [thread 143] futexes: 0x556f3a3d9660 ... 0x556f3a3da65c [ 2105480 ops/sec ]
|
| Averaged 2111486 operations/sec (+- 0,03%), total secs = 30
| Futex hashing: global hash
To:
| $ ./perf bench futex hash -r 30 -b 0
| # Running 'futex/hash' benchmark:
| Run summary [PID 2723]: 144 threads, each operating on 1024 [private] futexes for 30 secs.
|
|[thread 0] futexes: 0x560a09e487c0 ... 0x560a09e497bc [ 2135688 ops/sec ]
…
|[thread 143] futexes: 0x560a09ee9660 ... 0x560a09eea65c [ 2137668 ops/sec ]
|
| Averaged 2139685 operations/sec (+- 0,03%), total secs = 30
| Futex hashing: global hash
+1.34%. Again, not ground breaking but still visible. And the memory
savings.
That is btw, 7.2-rc1 on a Intel(R) Xeon(R) CPU E7-8890 v3 (4 NUMA
nodes).
Sebastian
More information about the linux-arm-kernel
mailing list