Currently the sequence for symbol_search to search a symbol is: 1) kernel
symname hash table, 2) iterate all kernel symbols, 3) iterate all kernel
modules and their symbols. In the worst case, if a non-exist symbol been
searched, all 3 stages will be went through. The time consuming status for
each stage is like:
stage 1 stage 2 stage 3
0.007000(ms) 0.593000(ms) 2.421000(ms)
stage 3 takes too much time when comparing to stage 1. This patch introduces
a symname hash table for kernel modules, to improve the performance of symbol
searching.
Functions symbol_search and symbol_exists are fundamental and widely used by
other crash functions, thus the benefit of performance improvement can
get accumulated. For example, "ps -m" and "irq" commands, which call
the functions many times, will become faster with the patch.
v5 -> v6:
1) Add mod_symname_hash table dump to help -s
2) Modified mod_symname_hash install/remove based on Kazu's suggestion.
Tao Liu (7):
Implement install and remove operations for mod_symname_hash
Integrate symbol_search with mod_symname_hash search
Extend symname_hash_search with hash table select
Intergrate symbol_exists with mod_symname_hash search
Sync module symbols into mod_symtable whenever module symbols change
Refactor SYMNAME_HASH_INDEX macro to be a function
Add mod_symname_hash table dump to help -s
defs.h | 3 +-
kernel.c | 1 +
symbols.c | 261 +++++++++++++++++++++++++++++++++---------------------
3 files changed, 164 insertions(+), 101 deletions(-)
--
2.29.2