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

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Fri Oct 15 02:12:47 UTC 2021


Hi Tao Liu,

One more comment, the mod_syment_hash also should be printed by help -s,
like symname_hash.

crash> set debug 1
debug: 1
crash> help -s
...
val_hash_iterations: 530  (avg: 75.7)
   symname_hash[512]: ff7808
    [  0]:  57  [  1]: 121  [  2]:  28  [  3]:  79  [  4]: 165  [  5]:  51  
    [  6]:  57  [  7]:  99  [  8]:  61  [  9]:  98  [ 10]: 108  [ 11]:  68

The other patches (2 to 6) look good to me.

Thanks,
Kazu


-----Original Message-----
> 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