Set the default to 6 (one marker every 64 symbols). Improves symbol lookup by name by about 35% (over an interval of 256). Net improvement for the patch series is about 18 times. Static data increases by a little less than 1 bit for every 2 symbols. Signed-off-by: David Laight --- init/Kconfig | 19 +++++++++++++++++++ scripts/link-vmlinux.sh | 6 ++++++ 2 files changed, 25 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 8583d9f06c52..2d0716662c67 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -2101,6 +2101,25 @@ config KALLSYMS symbolic stack backtraces. This increases the size of the kernel somewhat, as all symbols have to be loaded into the kernel image. +config KALLSYMS_MARKER_SHIFT + int "Interval between kallsyms markers (6 => 64, 8 => 256)" + depends on KALLSYMS + default 6 + range 0 24 + help + Set the interval between the kallsyms marker entries as a power of 2. + + This bounds the linear search when locating the name of a symbol + from its index in the array of values (and v.v.). + + Smaller values speed up the search but increase the memory footprint. + Values below 5 (one 32 bit marker every 32 symbols) are unlikely to + make a significant difference because other parts of the code + dominate. + + The default of 6 is a reasonable compromise. It makes looking up a + symbol by name around 35% faster than setting it to 8. + config KALLSYMS_SELFTEST bool "Test the basic functions and performance of kallsyms" depends on KALLSYMS diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index ab0b8125c8cb..12b119d024b4 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -37,6 +37,10 @@ is_enabled() { grep -q "^$1=y" include/config/auto.conf } +value() { + sed -n "/^$1=/{s///;p;q}" include/config/auto.conf +} + # Nice output in kbuild format # Will be suppressed by "make -s" info() @@ -131,6 +135,8 @@ kallsyms() kallsymopt="${kallsymopt} --pc-relative" fi + kallsymopt="${kallsymopt} --marker-shift=$(value CONFIG_KALLSYMS_MARKER_SHIFT)" + info KSYMS "${2}.S" scripts/kallsyms ${kallsymopt} "${1}" > "${2}.S" -- 2.39.5