Skip to content

Commit d622ece

Browse files
justin-hetorvalds
authored andcommitted
mm/memory_hotplug: introduce default dummy memory_add_physaddr_to_nid()
This is to introduce a general dummy helper. memory_add_physaddr_to_nid() is a fallback option to get the nid in case NUMA_NO_NID is detected. After this patch, arm64/sh/s390 can simply use the general dummy version. PowerPC/x86/ia64 will still use their specific version. This is the preparation to set a fallback value for dev_dax->target_node. Signed-off-by: Jia He <justin.he@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: David Hildenbrand <david@redhat.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Cc: Rich Felker <dalias@libc.org> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Baoquan He <bhe@redhat.com> Cc: Chuhong Yuan <hslester96@gmail.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Logan Gunthorpe <logang@deltatee.com> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Jonathan Cameron <Jonathan.Cameron@Huawei.com> Cc: Kaly Xin <Kaly.Xin@arm.com> Link: http://lkml.kernel.org/r/20200710031619.18762-2-justin.he@arm.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent fe124c9 commit d622ece

5 files changed

Lines changed: 10 additions & 22 deletions

File tree

‎arch/arm64/mm/numa.c‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,3 @@ void __init arm64_numa_init(void)
461461

462462
numa_init(dummy_numa_init);
463463
}
464-
465-
/*
466-
* We hope that we will be hotplugging memory on nodes we already know about,
467-
* such that acpi_get_node() succeeds and we never fall back to this...
468-
*/
469-
int memory_add_physaddr_to_nid(u64 addr)
470-
{
471-
pr_warn("Unknown node for memory at 0x%llx, assuming node 0\n", addr);
472-
return 0;
473-
}

‎arch/ia64/mm/numa.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,5 @@ int memory_add_physaddr_to_nid(u64 addr)
106106
return 0;
107107
return nid;
108108
}
109-
110-
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
111109
#endif
112110
#endif

‎arch/sh/mm/init.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -425,15 +425,6 @@ int arch_add_memory(int nid, u64 start, u64 size,
425425
return ret;
426426
}
427427

428-
#ifdef CONFIG_NUMA
429-
int memory_add_physaddr_to_nid(u64 addr)
430-
{
431-
/* Node 0 for now.. */
432-
return 0;
433-
}
434-
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
435-
#endif
436-
437428
void arch_remove_memory(int nid, u64 start, u64 size,
438429
struct vmem_altmap *altmap)
439430
{

‎arch/x86/mm/numa.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,5 +929,4 @@ int memory_add_physaddr_to_nid(u64 start)
929929
nid = numa_meminfo.blk[0].nid;
930930
return nid;
931931
}
932-
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
933932
#endif

‎mm/memory_hotplug.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
350350
return err;
351351
}
352352

353+
#ifdef CONFIG_NUMA
354+
int __weak memory_add_physaddr_to_nid(u64 start)
355+
{
356+
pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
357+
start);
358+
return 0;
359+
}
360+
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
361+
#endif
362+
353363
/* find the smallest valid pfn in the range [start_pfn, end_pfn) */
354364
static unsigned long find_smallest_section_pfn(int nid, struct zone *zone,
355365
unsigned long start_pfn,

0 commit comments

Comments
 (0)