From 9a149fa4b0a2f3593d5e5b940c64364d4e08084a Mon Sep 17 00:00:00 2001 From: Tao Zeng Date: Fri, 7 Aug 2020 17:34:30 +0800 Subject: [PATCH] rodata: optimize memory usage of rodata section [3/5] PD#SWPL-31258 Problem: Kernel RO data is too large, about 4.5mb on 32bit and 5.9mb on 64bit kernel Solution: 1, remove CONFIG_KALLSYMS_ALL in module.c, which can help to save about 200KB module memory during runtime compared from /proc/pagetrce: 3068, c020edd8, module_alloc -- before 2776, c020edd8, module_alloc -- after Verify: x301 Signed-off-by: Tao Zeng Change-Id: I15acee0df76f74a04c10d8f290d10fc35d51a283 --- kernel/module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/module.c b/kernel/module.c index be3b4356e5f8..6416fe1a5130 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2570,15 +2570,21 @@ static bool is_core_symbol(const Elf_Sym *src, const Elf_Shdr *sechdrs, || !src->st_name) return false; +#ifndef CONFIG_AMLOGIC_MODIFY #ifdef CONFIG_KALLSYMS_ALL if (src->st_shndx == pcpundx) return true; #endif +#endif /* ignore all symbols of moulde been loaded */ sec = sechdrs + src->st_shndx; if (!(sec->sh_flags & SHF_ALLOC) +#ifdef CONFIG_AMLOGIC_MODIFY + || !(sec->sh_flags & SHF_EXECINSTR) +#else #ifndef CONFIG_KALLSYMS_ALL || !(sec->sh_flags & SHF_EXECINSTR) +#endif #endif || (sec->sh_entsize & INIT_OFFSET_MASK)) return false;