The patch titled Subject: mm: drop CONFIG_HAVE_ARCH_NODEDATA_EXTENSION has been added to the -mm mm-unstable branch. Its filename is mm-drop-config_have_arch_nodedata_extension.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-drop-config_have_arch_nodedata_extension.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm 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 via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx> Subject: mm: drop CONFIG_HAVE_ARCH_NODEDATA_EXTENSION Date: Wed, 7 Aug 2024 09:40:52 +0300 There are no users of HAVE_ARCH_NODEDATA_EXTENSION left, so arch_alloc_nodedata() and arch_refresh_nodedata() are not needed anymore. Replace the call to arch_alloc_nodedata() in free_area_init() with a new helper alloc_offline_node_data(), remove arch_refresh_nodedata() and cleanup include/linux/memory_hotplug.h from the associated ifdefery. Link: https://lkml.kernel.org/r/20240807064110.1003856-9-rppt@xxxxxxxxxx Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx> Tested-by: Zi Yan <ziy@xxxxxxxxxx> # for x86_64 and arm64 Acked-by: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx> Cc: Andreas Larsson <andreas@xxxxxxxxxxx> Cc: Arnd Bergmann <arnd@xxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Christophe Leroy <christophe.leroy@xxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx> Cc: David S. Miller <davem@xxxxxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Heiko Carstens <hca@xxxxxxxxxxxxx> Cc: Huacai Chen <chenhuacai@xxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxxxxx> Cc: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> Cc: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx> Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx> Cc: Rob Herring (Arm) <robh@xxxxxxxxxx> Cc: Samuel Holland <samuel.holland@xxxxxxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memory_hotplug.h | 48 ------------------------------- include/linux/numa.h | 4 ++ mm/mm_init.c | 10 +----- mm/numa.c | 12 +++++++ 4 files changed, 18 insertions(+), 56 deletions(-) --- a/include/linux/memory_hotplug.h~mm-drop-config_have_arch_nodedata_extension +++ a/include/linux/memory_hotplug.h @@ -16,54 +16,6 @@ struct resource; struct vmem_altmap; struct dev_pagemap; -#ifdef CONFIG_HAVE_ARCH_NODEDATA_EXTENSION -/* - * For supporting node-hotadd, we have to allocate a new pgdat. - * - * If an arch has generic style NODE_DATA(), - * node_data[nid] = kzalloc() works well. But it depends on the architecture. - * - * In general, generic_alloc_nodedata() is used. - * - */ -extern pg_data_t *arch_alloc_nodedata(int nid); -extern void arch_refresh_nodedata(int nid, pg_data_t *pgdat); - -#else /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - -#define arch_alloc_nodedata(nid) generic_alloc_nodedata(nid) - -#ifdef CONFIG_NUMA -/* - * XXX: node aware allocation can't work well to get new node's memory at this time. - * Because, pgdat for the new node is not allocated/initialized yet itself. - * To use new node's memory, more consideration will be necessary. - */ -#define generic_alloc_nodedata(nid) \ -({ \ - memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); \ -}) - -extern pg_data_t *node_data[]; -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ - node_data[nid] = pgdat; -} - -#else /* !CONFIG_NUMA */ - -/* never called */ -static inline pg_data_t *generic_alloc_nodedata(int nid) -{ - BUG(); - return NULL; -} -static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) -{ -} -#endif /* CONFIG_NUMA */ -#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ - #ifdef CONFIG_MEMORY_HOTPLUG struct page *pfn_to_online_page(unsigned long pfn); --- a/include/linux/numa.h~mm-drop-config_have_arch_nodedata_extension +++ a/include/linux/numa.h @@ -33,6 +33,8 @@ static inline bool numa_valid_node(int n extern struct pglist_data *node_data[]; #define NODE_DATA(nid) (node_data[nid]) +void __init alloc_offline_node_data(int nid); + /* Generic implementation available */ int numa_nearest_node(int node, unsigned int state); @@ -60,6 +62,8 @@ static inline int phys_to_target_node(u6 { return 0; } + +static inline void alloc_offline_node_data(int nid) {} #endif #define numa_map_to_online_node(node) numa_nearest_node(node, N_ONLINE) --- a/mm/mm_init.c~mm-drop-config_have_arch_nodedata_extension +++ a/mm/mm_init.c @@ -1836,14 +1836,8 @@ void __init free_area_init(unsigned long for_each_node(nid) { pg_data_t *pgdat; - if (!node_online(nid)) { - /* Allocator not initialized yet */ - pgdat = arch_alloc_nodedata(nid); - if (!pgdat) - panic("Cannot allocate %zuB for node %d.\n", - sizeof(*pgdat), nid); - arch_refresh_nodedata(nid, pgdat); - } + if (!node_online(nid)) + alloc_offline_node_data(nid); pgdat = NODE_DATA(nid); free_area_init_node(nid); --- a/mm/numa.c~mm-drop-config_have_arch_nodedata_extension +++ a/mm/numa.c @@ -6,6 +6,18 @@ struct pglist_data *node_data[MAX_NUMNODES]; EXPORT_SYMBOL(node_data); +void __init alloc_offline_node_data(int nid) +{ + pg_data_t *pgdat; + + pgdat = memblock_alloc(sizeof(*pgdat), SMP_CACHE_BYTES); + if (!pgdat) + panic("Cannot allocate %zuB for node %d.\n", + sizeof(*pgdat), nid); + + node_data[nid] = pgdat; +} + /* Stub functions: */ #ifndef memory_add_physaddr_to_nid _ Patches currently in -mm which might be from rppt@xxxxxxxxxx are mm-move-kernel-numac-to-mm.patch mips-sgi-ip27-make-node_data-the-same-as-on-all-other-architectures.patch mips-sgi-ip27-ensure-node_possible_map-only-contains-valid-nodes.patch mips-sgi-ip27-drop-have_arch_nodedata_extension.patch mips-loongson64-rename-__node_data-to-node_data.patch mips-loongson64-drop-have_arch_nodedata_extension.patch arch-mm-move-definition-of-node_data-to-generic-code.patch mm-drop-config_have_arch_nodedata_extension.patch arch-mm-pull-out-allocation-of-node_data-to-generic-code.patch x86-numa-simplify-numa_distance-allocation.patch x86-numa-use-get_pfn_range_for_nid-to-verify-that-node-spans-memory.patch x86-numa-move-fake_node_-defines-to-numa_emu.patch x86-numa_emu-simplify-allocation-of-phys_dist.patch x86-numa_emu-split-__apicid_to_node-update-to-a-helper-function.patch x86-numa_emu-use-a-helper-function-to-get-max_dma32_pfn.patch x86-numa-numa_addremove_cpu-make-cpu-parameter-unsigned.patch mm-introduce-numa_memblks.patch mm-move-numa_distance-and-related-code-from-x86-to-numa_memblks.patch mm-introduce-numa_emulation.patch mm-numa_memblks-introduce-numa_memblks_init.patch mm-numa_memblks-make-several-functions-and-variables-static.patch mm-numa_memblks-use-memblock_startend_of_dram-when-sanitizing-meminfo.patch of-numa-return-einval-when-no-numa-node-id-is-found.patch arch_numa-switch-over-to-numa_memblks.patch arch_numa-switch-over-to-numa_memblks-fix.patch mm-make-range-to-target_node-lookup-facility-a-part-of-numa_memblks.patch docs-move-numa=fake-description-to-kernel-parameterstxt.patch