diff mbox series

[v3,1/6] mm/memory_hotplug: introduce default dummy memory_add_physaddr_to_nid()

Message ID 20200709020629.91671-2-justin.he@arm.com
State New
Headers show
Series Fix and enable pmem as RAM device on arm64 | expand

Commit Message

Justin He July 9, 2020, 2:06 a.m. UTC
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.

Signed-off-by: Jia He <justin.he@arm.com>
---
 mm/memory_hotplug.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

David Hildenbrand July 9, 2020, 9:10 a.m. UTC | #1
On 09.07.20 04:06, Jia He wrote:
> 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.
> 
> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  mm/memory_hotplug.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index da374cd3d45b..b49ab743d914 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -350,6 +350,16 @@ int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
>  	return err;
>  }
>  
> +#ifdef CONFIG_NUMA
> +int __weak memory_add_physaddr_to_nid(u64 start)
> +{
> +	pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
> +			start);
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
> +#endif
> +
>  /* find the smallest valid pfn in the range [start_pfn, end_pfn) */
>  static unsigned long find_smallest_section_pfn(int nid, struct zone *zone,
>  				     unsigned long start_pfn,
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index da374cd3d45b..b49ab743d914 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -350,6 +350,16 @@  int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages,
 	return err;
 }
 
+#ifdef CONFIG_NUMA
+int __weak memory_add_physaddr_to_nid(u64 start)
+{
+	pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
+			start);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+#endif
+
 /* find the smallest valid pfn in the range [start_pfn, end_pfn) */
 static unsigned long find_smallest_section_pfn(int nid, struct zone *zone,
 				     unsigned long start_pfn,