linux-stable/kernel/livepatch
Zhen Lei 07cc2c931e 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 <pmladek@suse.com>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20230116101009.23694-2-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-01-19 17:07:15 -08:00
..
core.c livepatch: Improve the search performance of module_kallsyms_on_each_symbol() 2023-01-19 17:07:15 -08:00
core.h
Kconfig livepatch: Use the default ftrace_ops instead of REGS when ARGS is available 2020-11-13 12:15:28 -05:00
Makefile
patch.c ftrace: rename ftrace_instruction_pointer_set() -> ftrace_regs_set_instruction_pointer() 2022-11-18 13:56:41 +00:00
patch.h
shadow.c Documentation: livepatch: Add livepatch API page 2021-12-23 11:35:53 +01:00
state.c kernel/: fix repeated words in comments 2020-10-16 11:11:19 -07:00
state.h livepatch: Allow to distinguish different version of system state changes 2019-11-01 13:08:19 +01:00
transition.c livepatch: Move the result-invariant calculation out of the loop 2022-10-18 15:50:31 +02:00
transition.h