# Re: \[PATCH v3 2/3\] module/kallsyms: Refactor current symbol filtering into is\_kept\_symbol()

- From: Tiezhu Yang \<yangtiezhu@loongson.cn\>
- Date: 2026-08-18 13:05:10 
- List: linux-modules
- Page: https://ratatoskr.run/linux-modules/2026/08/17428933
- Thread: https://ratatoskr.run/linux-modules/2026/08/17399756/t.md

```text
On 2026/8/18 下午7:58, Petr Pavlu wrote:
> 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@suse.com>
>> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
>
> 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.

OK, let me use is_core_symbol() in v4.

> 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@suse.com>

Thanks,
Tiezhu

```
