lkml.org 
[lkml]   [2024]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch v2] mm/memblock: discard .text/.data if CONFIG_ARCH_KEEP_MEMBLOCK not set
Hi,

On Fri, May 10, 2024 at 02:04:22AM +0000, Wei Yang wrote:
> When CONFIG_ARCH_KEEP_MEMBLOCK not set, we expect to discard related
> code and data. But it doesn't until CONFIG_MEMORY_HOTPLUG not set
> neither.
>
> This patch puts memblock's .text/.data into its own section, so that it
> only depends on CONFIG_ARCH_KEEP_MEMBLOCK to discard related code and
> data.
>
> After this, from the log message in mem_init_print_info(), init size
> increase from 2420K to 2432K on arch x86.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>
> ---
> v2: fix orphan section for powerpc
> ---
> arch/powerpc/kernel/vmlinux.lds.S | 1 +
> include/asm-generic/vmlinux.lds.h | 14 +++++++++++++-
> include/linux/memblock.h | 8 ++++----
> 3 files changed, 18 insertions(+), 5 deletions(-)
>
> +#define __init_memblock __section(".mbinit.text") __cold notrace \
> + __latent_entropy
> +#define __initdata_memblock __section(".mbinit.data")
> +

The new .mbinit.* sections should be added to scripts/mod/modpost.c
alongside .meminit.* sections and then I expect modpost to report a bunch
of section mismatches because many memblock functions are called on memory
hotplug even on architectures that don't select ARCH_KEEP_MEMBLOCK.

> #ifndef CONFIG_ARCH_KEEP_MEMBLOCK
> -#define __init_memblock __meminit
> -#define __initdata_memblock __meminitdata
> void memblock_discard(void);
> #else
> -#define __init_memblock
> -#define __initdata_memblock
> static inline void memblock_discard(void) {}
> #endif
>
> --
> 2.34.1
>
>

--
Sincerely yours,
Mike.

\
 
 \ /
  Last update: 2024-05-21 09:23    [W:0.038 / U:22.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site