From: Michal Hocko mhocko@suse.com
mainline inclusion from mainline-v5.18-rc1 commit 390511e1476eb1cc41d420a7661b33f4d8584c3f category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8EQ3K
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
Prior to "mm: handle uninitialized numa nodes gracefully" memory hotplug used to allocate pgdat when memory has been added to a node (hotadd_init_pgdat) arch_free_nodedata has been only used in the failure path because once the pgdat is exported (to be visible by NODA_DATA(nid)) it cannot really be freed because there is no synchronization available for that.
pgdat is allocated for each possible nodes now so the memory hotplug doesn't need to do the ever use arch_free_nodedata so drop it.
This patch doesn't introduce any functional change.
Link: https://lkml.kernel.org/r/20220127085305.20890-4-mhocko@kernel.org Signed-off-by: Michal Hocko mhocko@suse.com Acked-by: Rafael Aquini raquini@redhat.com Acked-by: David Hildenbrand david@redhat.com Acked-by: Mike Rapoport rppt@linux.ibm.com Reviewed-by: Oscar Salvador osalvador@suse.de Cc: Alexey Makhalov amakhalov@vmware.com Cc: Christoph Lameter cl@linux.com Cc: Dennis Zhou dennis@kernel.org Cc: Eric Dumazet eric.dumazet@gmail.com Cc: Nico Pache npache@redhat.com Cc: Tejun Heo tj@kernel.org Cc: Wei Yang richard.weiyang@gmail.com Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Linus Torvalds torvalds@linux-foundation.org
Conflicts: mm/memory_hotplug.c Signed-off-by: Ma Wupeng mawupeng1@huawei.com --- arch/ia64/mm/discontig.c | 5 ----- include/linux/memory_hotplug.h | 3 --- mm/memory_hotplug.c | 10 ---------- 3 files changed, 18 deletions(-)
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c index d72ad280c932..224d590ca0d4 100644 --- a/arch/ia64/mm/discontig.c +++ b/arch/ia64/mm/discontig.c @@ -637,11 +637,6 @@ pg_data_t * __init arch_alloc_nodedata(int nid) return memblock_alloc(size, SMP_CACHE_BYTES); }
-void arch_free_nodedata(pg_data_t *pgdat) -{ - kfree(pgdat); -} - void arch_refresh_nodedata(int update_node, pg_data_t *update_pgdat) { pgdat_list[update_node] = update_pgdat; diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index aaacbd41940d..c6ca309fc45e 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -23,17 +23,14 @@ struct vmem_altmap; * node_data[nid] = kzalloc() works well. But it depends on the architecture. * * In general, generic_alloc_nodedata() is used. - * Now, arch_free_nodedata() is just defined for error path of node_hot_add. * */ extern pg_data_t *arch_alloc_nodedata(int nid); -extern void arch_free_nodedata(pg_data_t *pgdat); 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) -#define arch_free_nodedata(pgdat) generic_free_nodedata(pgdat)
#ifdef CONFIG_NUMA /* diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 12698242b03d..cbd6cd96e98b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -819,16 +819,6 @@ static pg_data_t __ref *hotadd_init_pgdat(int nid) return pgdat; }
-static void rollback_node_hotadd(int nid) -{ - pg_data_t *pgdat = NODE_DATA(nid); - - arch_refresh_nodedata(nid, NULL); - free_percpu(pgdat->per_cpu_nodestats); - arch_free_nodedata(pgdat); -} - - /** * try_online_node - online a node if offlined * @nid: the node ID