Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • include
  • linux
  • module.h
Find file BlameHistoryPermalink
  • Zhen Lei's avatar
    livepatch: Improve the search performance of module_kallsyms_on_each_symbol() · 07cc2c93
    Zhen Lei authored Jan 16, 2023
    
    
    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: default avatarPetr Mladek <pmladek@suse.com>
    Acked-by: default avatarSong Liu <song@kernel.org>
    Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Acked-by: default avatarMiroslav Benes <mbenes@suse.cz>
    Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
    Link: https://lore.kernel.org/r/20230116101009.23694-2-jolsa@kernel.org
    
    
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    07cc2c93
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7