summaryrefslogtreecommitdiff
path: root/tools/lib/python/kdoc
diff options
context:
space:
mode:
authorJim Cromie <jim.cromie@gmail.com>2026-09-29 12:07:31 -0600
committerAndrew Morton <akpm@linux-foundation.org>2026-10-08 23:06:53 -0700
commit5611204b0b7928cae7dfc9739706c7f220abdfc8 (patch)
tree384bc763dbb33556609a58b62aacbca75d7e419f /tools/lib/python/kdoc
parent65d2cb576dd4ce4a7d1d5b5be93d9739cc9ef419 (diff)
downloadlinux-next-5611204b0b7928cae7dfc9739706c7f220abdfc8.tar.gz
linux-next-5611204b0b7928cae7dfc9739706c7f220abdfc8.zip
kallsyms: increase marker density to 16:1 to accelerate lookups
kallsyms stores symbols with remarkably efficient packing, and simple streaming unpacking, laid out sequentially in address order. That said, variable-length records make arbitrary access inherently linear. kallsyms_markers[] addressed this by marking stream offsets every 256 symbols, reducing the scan distance by 256x down to an average of 127.5 sequential steps. While 127.5 hops was negligible for rare, single-shot oops backtraces, both table size (~184k symbols) and lookup traffic have expanded substantially. In alphabetical binary search (kallsyms_lookup_names), each of the ~17 comparison probes must locate candidate symbols via get_symbol_offset(), compounding into ~2,170 sequential symbol hops per lookup. In bulk tracing workloads (such as BPF multi-kprobe attach), this penalty compounds into multi-second latency. 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. In-tree CONFIG_KALLSYMS_SELFTEST measurements across all ~184k symbols show average lookup latency dropping from 6,102 ns down to 866 ns (a 7.0x speedup). Link: https://lore.kernel.org/20260929-ksyms-tune-v7-2-be568ceef41e@gmail.com Signed-off-by: Jim Cromie <jim.cromie@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Kees Cook <kees@kernel.org> Cc: Petr Mladek <pmladek@suse.com> Cc: Zhen Lei <thunder.leizhen@huawei.com> Cc: Luis Chamberlain <mcgrof@kernel.org> Cc: Andrey Grodzovsky <andrey.grodzovsky@crowdstrike.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: David Laight <david.laight.linux@gmail.com> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Jiri Olsa <olsajiri@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'tools/lib/python/kdoc')
0 files changed, 0 insertions, 0 deletions