[RFC PATCH v2 7/7] futex: Use runtime constants for __futex_hash() hot path
Sebastian Andrzej Siewior
bigeasy at linutronix.de
Mon Mar 16 01:14:29 PDT 2026
On 2026-03-16 05:24:01 [+0000], K Prateek Nayak wrote:
> From: Peter Zijlstra <peterz at infradead.org>
>
> Runtime constify the read-only after init data __futex_shift(shift_32),
> __futex_mask(mask_32), and __futex_queues(ptr) used in __futex_hash()
> hot path to avoid referencing global variable.
>
> This also allows __futex_queues to be allocated dynamically to
> "nr_node_ids" slots instead of reserving config dependent MAX_NUMNODES
> (1 << CONFIG_NODES_SHIFT) worth of slots upfront.
>
> No functional chages intended.
>
> [ prateek: Dynamically allocate __futex_queues, mark the global data
> __ro_after_init since they are constified after futex_init(). ]
>
> Link: https://patch.msgid.link/20260227161841.GH606826@noisy.programming.kicks-ass.net
> Reported-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de> # MAX_NUMNODES bloat
> Not-yet-signed-off-by: Peter Zijlstra <peterz at infradead.org>
> Signed-off-by: K Prateek Nayak <kprateek.nayak at amd.com>
This all looks nice. Let me look later at the resulting code. Thank you
so far ;)
Sebastian
More information about the linux-riscv
mailing list