The patch titled Subject: init: provide a generic free_initmem implementation has been added to the -mm tree. Its filename is init-provide-a-generic-free_initmem-implementation.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/init-provide-a-generic-free_initmem-implementation.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/init-provide-a-generic-free_initmem-implementation.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Mike Rapoport <rppt@xxxxxxxxxxxxx> Subject: init: provide a generic free_initmem implementation Patch series "provide a generic free_initmem implementation", v2. Many architectures implement free_initmem() in exactly the same or very similar way: they wrap the call to free_initmem_default() with sometimes different 'poison' parameter. These patches switch those architectures to use a generic implementation that does free_initmem_default(POISON_FREE_INITMEM). This was inspired by Christoph's patches for free_initrd_mem [1] and I shamelessly copied changelog entries from his patches :) [1] https://lore.kernel.org/lkml/20190213174621.29297-1-hch@xxxxxx/ This patch (of 2): For most architectures free_initmem just a wrapper for the same free_initmem_default(-1) call. Provide that as a generic implementation marked __weak. Link: http://lkml.kernel.org/r/1550515285-17446-2-git-send-email-rppt@xxxxxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxx> Cc: Richard Kuo <rkuo@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- arch/alpha/mm/init.c | 6 ------ arch/arc/mm/init.c | 8 -------- arch/c6x/mm/init.c | 5 ----- arch/h8300/mm/init.c | 6 ------ arch/microblaze/mm/init.c | 5 ----- arch/nds32/mm/init.c | 5 ----- arch/nios2/mm/init.c | 5 ----- arch/openrisc/mm/init.c | 5 ----- arch/sh/mm/init.c | 5 ----- arch/unicore32/mm/init.c | 5 ----- arch/xtensa/mm/init.c | 5 ----- init/main.c | 5 +++++ 12 files changed, 5 insertions(+), 60 deletions(-) --- a/arch/alpha/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/alpha/mm/init.c @@ -285,9 +285,3 @@ mem_init(void) memblock_free_all(); mem_init_print_info(NULL); } - -void -free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/arc/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/arc/mm/init.c @@ -206,11 +206,3 @@ void __init mem_init(void) memblock_free_all(); mem_init_print_info(NULL); } - -/* - * free_initmem: Free all the __init memory. - */ -void __ref free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/c6x/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/c6x/mm/init.c @@ -68,8 +68,3 @@ void __init mem_init(void) mem_init_print_info(NULL); } - -void __init free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/h8300/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/h8300/mm/init.c @@ -102,9 +102,3 @@ void __init mem_init(void) mem_init_print_info(NULL); } - -void -free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/microblaze/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/microblaze/mm/init.c @@ -186,11 +186,6 @@ void __init setup_memory(void) paging_init(); } -void free_initmem(void) -{ - free_initmem_default(-1); -} - void __init mem_init(void) { high_memory = (void *)__va(memory_start + lowmem_size - 1); --- a/arch/nds32/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/nds32/mm/init.c @@ -252,11 +252,6 @@ void __init mem_init(void) return; } -void free_initmem(void) -{ - free_initmem_default(-1); -} - void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags) { --- a/arch/nios2/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/nios2/mm/init.c @@ -82,11 +82,6 @@ void __init mmu_init(void) flush_tlb_all(); } -void __ref free_initmem(void) -{ - free_initmem_default(-1); -} - #define __page_aligned(order) __aligned(PAGE_SIZE << (order)) pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER); pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER); --- a/arch/openrisc/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/openrisc/mm/init.c @@ -223,8 +223,3 @@ void __init mem_init(void) mem_init_done = 1; return; } - -void free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/sh/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/sh/mm/init.c @@ -403,11 +403,6 @@ void __init mem_init(void) mem_init_done = 1; } -void free_initmem(void) -{ - free_initmem_default(-1); -} - #ifdef CONFIG_MEMORY_HOTPLUG int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap, bool want_memblock) --- a/arch/unicore32/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/unicore32/mm/init.c @@ -287,8 +287,3 @@ void __init mem_init(void) sysctl_overcommit_memory = OVERCOMMIT_ALWAYS; } } - -void free_initmem(void) -{ - free_initmem_default(-1); -} --- a/arch/xtensa/mm/init.c~init-provide-a-generic-free_initmem-implementation +++ a/arch/xtensa/mm/init.c @@ -216,11 +216,6 @@ void free_initrd_mem(unsigned long start } #endif -void free_initmem(void) -{ - free_initmem_default(-1); -} - static void __init parse_memmap_one(char *p) { char *oldp; --- a/init/main.c~init-provide-a-generic-free_initmem-implementation +++ a/init/main.c @@ -1061,6 +1061,11 @@ static inline void mark_readonly(void) } #endif +void __weak free_initmem(void) +{ + free_initmem_default(-1); +} + static int __ref kernel_init(void *unused) { int ret; _ Patches currently in -mm which might be from rppt@xxxxxxxxxxxxx are init-provide-a-generic-free_initmem-implementation.patch hexagon-switch-over-to-generic-free_initmem.patch init-free_initmem-poison-freed-init-memory.patch riscv-switch-over-to-generic-free_initmem.patch