This patch series optimizes symbol handling in crash utility for RISCV64
architecture, particularly beneficial when debugging kernels with large
symbol tables (900K+ symbols).
Background:
On a 32-core RISCV64 physical machine running Linux 6.12.13, the kernel
symbol table contains over 900,000 entries (wc -l /proc/kallsyms). When
using crash utility to analyze vmcore or live system, significant time
is spent in symbol-related operations, specifically:
1. Symbol name hash lookups - the original simple hash function causes
high collision rates with large symbol tables
2. Processing of linker-generated mapping symbols (.L*, L0*, $*) which
are unnecessary for debugging but consume processing time
Patch 1: Optimize symname_hash with larger table and FNV-1a hash
- Increases SYMNAME_HASH from 512 to 16384 (32x) to reduce collisions
- Replaces simple hash with FNV-1a algorithm for better distribution
- Removes strlen() call by computing hash in single pass
This reduces average hash bucket chain length significantly, improving
symbol lookup performance at the cost of ~248KB additional memory.
Patch 2: Add mapping symbol filter in riscv64_verify_symbol
- Filters out linker mapping symbols (.L*, L0*, $*) that should not be
in the symbol list
- Also optimizes riscv64_verify_symbol() by consolidating name validity
checks
Together these patches improve crash utility startup and symbol lookup
performance on RISCV64 systems with large kernel symbol tables.
Rui Qi (2):
symbols: optimize symname_hash with larger table and FNV-1a hash
RISCV64: add mapping symbol filter in riscv64_verify_symbol
defs.h | 2 +-
riscv64.c | 14 +++++++++++---
symbols.c | 20 ++++++++++++++------
3 files changed, 27 insertions(+), 9 deletions(-)
--
2.43.0