Re: [PATCH v7 2/3] kallsyms: Increase marker density to 16:1 to accelerate lookups
From: Kees Cook
Date: Wed Sep 30 2026 - 02:28:34 EST
On Tue, Sep 29, 2026 at 12:07:31PM -0600, Jim Cromie via B4 Relay wrote:
> Without altering the underlying storage layout, we can retune this
> trade-off directly by increasing marker density from 256:1 down to
> 16:1 (KALLSYMS_MARKER_SHIFT 4) in kernel/kallsyms_internal.h, shared
> between scripts/kallsyms.c and kernel/kallsyms.c.
>
> This caps the remainder scan at 15 symbols and cuts average scan distance
> from 127.5 down to 7.5 hops (a 17x reduction). Across a 17-step binary
> search, total hops collapse from ~2,170 down to ~127. For a kernel with
> ~184,000 symbols, this adds ~10,800 u32 marker entries (+42 KiB) to
> write-protected .rodata.
Thanks for trying a non 1:1 route. I think this is a reasonable time/space
trade-off. ~42k .rodata to get a large speed-up.
Reviewed-by: Kees Cook <kees@xxxxxxxxxx>
--
Kees Cook