kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[]
authorZhen Lei <thunder.leizhen@huawei.com>
Wed, 2 Nov 2022 08:49:16 +0000 (16:49 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Oct 2023 10:03:16 +0000 (12:03 +0200)
commitda359f699f5942ca383f528d144fc17c7c95e78a
treef0e5e71445eaa21e193c4343163d11ccec5ed603
parent3918cada8f1b247ad11a41872584232361e1d140
kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[]

[ Upstream commit 19bd8981dc2ee35fdc81ab1b0104b607c917d470 ]

kallsyms_seqs_of_names[] records the symbol index sorted by address, the
maximum value in kallsyms_seqs_of_names[] is the number of symbols. And
2^24 = 16777216, which means that three bytes are enough to store the
index. This can help us save (1 * kallsyms_num_syms) bytes of memory.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Stable-dep-of: b022f0c7e404 ("tracing/kprobes: Return EADDRNOTAVAIL when func matches several symbols")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/kallsyms.c
kernel/kallsyms_internal.h
scripts/kallsyms.c