Re: [PATCH v3 2/3] module/kallsyms: Refactor current symbol filtering into is_kept_symbol()
From: Petr Pavlu
Date: Tue Aug 18 2026 - 07:59:08 EST
On 8/12/26 5:28 AM, Tiezhu Yang wrote:
> Currently, the loops in layout_symtab() and add_kallsyms() duplicate the
> exact same checks (i == 0 || is_livepatch_module() || is_core_symbol())
> to determine whether a symbol should be preserved in the module's core
> symbol table.
>
> Rename is_core_symbol() to is_kept_symbol() and move the entire checking
> logic inside it, including the special handlers for the first symbol and
> livepatch modules.
>
> No functional change.
>
> Suggested-by: Petr Pavlu <petr.pavlu@xxxxxxxx>
> Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
Looks ok to me. I'm also fine also keeping the current name,
is_core_symbol(), as Huacai mentions in his review [1]. I previously
suggested is_kept_symbol() [2], since the is_livepatch_module() check
is moved into this function. However, is_core_symbol() is still ok, as
it is consistent with where the symbols are assigned, in
module::core_kallsyms.
The important part is to avoid duplicating the checks that determine
whether a symbol should be kept in layout_symtab() and add_kallsyms().
Reviewed-by: Petr Pavlu <petr.pavlu@xxxxxxxx>
[1] https://lore.kernel.org/linux-modules/CAAhV-H5w8VVW_L6cRes-syjEvhbWmevSKWrZWPFapRkuemmjaw@xxxxxxxxxxxxxx/
[2] https://lore.kernel.org/linux-modules/39a48465-22b6-4b18-9f7e-ce258513181b@xxxxxxxx/
--
Thanks,
Petr