[Crash-utility] [PATCH v5 0/6] Improve kernel modules symbol searching performance

Tao Liu ltao at redhat.com
Mon Oct 11 14:13:15 UTC 2021


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.

v4 -> v5:

1) Seperated kernel modules syment install from kernel syment install,
making them 2 independent functions. Thus kernel modules syment can get sorted
when installed into mod_syment_hash. And spn->cnt stays untouched in v5.
2) Removed syment_is_installed check, it is no longer needed for the new
kernel modules syment install function.
3) Splitted the patches into smaller ones for better patch review.
4) Changed SYMNAME_HASH_INDEX macro into symname_hash_index function. 
5) v5 patch can be applied to master branch, for crash-7-branch it needs
slightly modification.

Tao Liu (6):
  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

 defs.h    |   3 +-
 kernel.c  |   1 +
 symbols.c | 212 ++++++++++++++++++++++++++++++++++--------------------
 3 files changed, 137 insertions(+), 79 deletions(-)

-- 
2.29.2




More information about the Crash-utility mailing list