diff options
| author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2026-07-01 18:17:36 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-07-29 13:17:52 +0200 |
| commit | 5e601ab3615c86be7c4068ce992f94654693a032 (patch) | |
| tree | 215e3ecf7ed2eea102786690229bcaf97f2ab1ff /tools/perf/scripts/python/export-to-postgresql.py | |
| parent | b78b0b65825275f58336a43611a700de174be8c3 (diff) | |
futex: Optimise the size check get_futex_key()
The futex address must be naturally aligned and this is checked via
"address % size" where `address' is the supplied address and `size' is
the expected size of futex. It is guaranteed that `size' is power of two
but the compiler does not see it and creates here a `div' operation
(x86, arm, gcc-15).
We can take advantage of the pow2 property and rewrite it as
"address & (size-1)".
As per testing, the command
|perf bench futex hash -f 1 -b 16384 -t 1 -r 30
improved from
| [thread 0] futex: 0x5619f931f740 [ 7001583 ops/sec ]
to
| [thread 0] futex: 0x55da173e5740 [ 7376137 ops/sec ]
or by 5.3%
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260701161736.xYYizA0e@linutronix.de
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions
