diff options
author | Zhen Lei <[email protected]> | 2023-01-16 11:10:07 +0100 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2023-01-19 17:07:15 -0800 |
commit | 07cc2c931e8e1083a31f4c51d2244fe264af63bf (patch) | |
tree | 1abb9ab286d6310e872dcb99448c65bd10a85748 /tools/testing/selftests/bpf/prog_tests/prog_array_init.c | |
parent | 92afc5329a5b23d876b215b783d200352d5aaea6 (diff) |
livepatch: Improve the search performance of module_kallsyms_on_each_symbol()
Currently we traverse all symbols of all modules to find the specified
function for the specified module. But in reality, we just need to find
the given module and then traverse all the symbols in it.
Let's add a new parameter 'const char *modname' to function
module_kallsyms_on_each_symbol(), then we can compare the module names
directly in this function and call hook 'fn' after matching. If 'modname'
is NULL, the symbols of all modules are still traversed for compatibility
with other usage cases.
Phase1: mod1-->mod2..(subsequent modules do not need to be compared)
|
Phase2: -->f1-->f2-->f3
Assuming that there are m modules, each module has n symbols on average,
then the time complexity is reduced from O(m * n) to O(m) + O(n).
Reviewed-by: Petr Mladek <[email protected]>
Acked-by: Song Liu <[email protected]>
Signed-off-by: Zhen Lei <[email protected]>
Signed-off-by: Jiri Olsa <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Reviewed-by: Luis Chamberlain <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/prog_array_init.c')
0 files changed, 0 insertions, 0 deletions