linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3).
@ 2006-12-20 14:09 Yasunori Goto
  2006-12-20 17:15 ` David Rientjes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yasunori Goto @ 2006-12-20 14:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: David Rientjes, Linux Kernel ML, Andi Kleen, Randy Dunlap

Hello.

This is take 3 patch to fix compile error when config
memory hotplug with numa on i386.

The cause of compile error was missing of arch_add_memory(), remove_memory(),
and memory_add_physaddr_to_nid().

I fixed some bad points, and tested no compile error of it.

This is for 2.6.20-rc1. 

Please apply.

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

---
 arch/i386/mm/discontig.c |   28 ++++++++++++++++++++++++++++
 arch/i386/mm/init.c      |   10 ++--------
 2 files changed, 30 insertions(+), 8 deletions(-)

Index: linux-2.6.20-rc1/arch/i386/mm/init.c
===================================================================
--- linux-2.6.20-rc1.orig/arch/i386/mm/init.c	2006-12-20 22:12:07.000000000 +0900
+++ linux-2.6.20-rc1/arch/i386/mm/init.c	2006-12-20 22:12:09.000000000 +0900
@@ -673,16 +673,10 @@
 #endif
 }
 
-/*
- * this is for the non-NUMA, single node SMP system case.
- * Specifically, in the case of x86, we will always add
- * memory to the highmem for now.
- */
 #ifdef CONFIG_MEMORY_HOTPLUG
-#ifndef CONFIG_NEED_MULTIPLE_NODES
 int arch_add_memory(int nid, u64 start, u64 size)
 {
-	struct pglist_data *pgdata = &contig_page_data;
+	struct pglist_data *pgdata = NODE_DATA(nid);
 	struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
@@ -694,7 +688,7 @@
 {
 	return -EINVAL;
 }
-#endif
+EXPORT_SYMBOL_GPL(remove_memory);
 #endif
 
 struct kmem_cache *pgd_cache;
Index: linux-2.6.20-rc1/arch/i386/mm/discontig.c
===================================================================
--- linux-2.6.20-rc1.orig/arch/i386/mm/discontig.c	2006-12-20 22:12:07.000000000 +0900
+++ linux-2.6.20-rc1/arch/i386/mm/discontig.c	2006-12-20 22:37:54.000000000 +0900
@@ -405,3 +405,31 @@
 	totalram_pages += totalhigh_pages;
 #endif
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int paddr_to_nid(u64 addr)
+{
+	int nid;
+	unsigned long pfn = PFN_DOWN(addr);
+
+	for_each_node(nid)
+		if (node_start_pfn[nid] <= pfn &&
+		    pfn < node_end_pfn[nid])
+			return nid;
+
+	return -1;
+}
+
+/*
+ * This function is used to ask node id BEFORE memmap and mem_section's
+ * initialization (pfn_to_nid() can't be used yet).
+ * If _PXM is not defined on ACPI's DSDT, node id must be found by this.
+ */
+int memory_add_physaddr_to_nid(u64 addr)
+{
+	int nid = paddr_to_nid(addr);
+	return (nid >= 0) ? nid : 0;
+}
+
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
+#endif

-- 
Yasunori Goto 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3).
  2006-12-20 14:09 [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3) Yasunori Goto
@ 2006-12-20 17:15 ` David Rientjes
  2006-12-21  0:27 ` Randy Dunlap
  2006-12-21  5:09 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2006-12-20 17:15 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: Andrew Morton, Linux Kernel ML, Andi Kleen, Randy Dunlap

On Wed, 20 Dec 2006, Yasunori Goto wrote:

> Hello.
> 
> This is take 3 patch to fix compile error when config
> memory hotplug with numa on i386.
> 
> The cause of compile error was missing of arch_add_memory(), remove_memory(),
> and memory_add_physaddr_to_nid().
> 
> I fixed some bad points, and tested no compile error of it.
> 
> This is for 2.6.20-rc1. 
> 
> Please apply.
> 
> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

Acked-by: David Rientjes <rientjes@cs.washington.edu>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3).
  2006-12-20 14:09 [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3) Yasunori Goto
  2006-12-20 17:15 ` David Rientjes
@ 2006-12-21  0:27 ` Randy Dunlap
  2006-12-21  5:09 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: Randy Dunlap @ 2006-12-21  0:27 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: Andrew Morton, David Rientjes, Linux Kernel ML, Andi Kleen

On Wed, 20 Dec 2006 23:09:58 +0900 Yasunori Goto wrote:

> Hello.
> 
> This is take 3 patch to fix compile error when config
> memory hotplug with numa on i386.
> 
> The cause of compile error was missing of arch_add_memory(), remove_memory(),
> and memory_add_physaddr_to_nid().
> 
> I fixed some bad points, and tested no compile error of it.
> 
> This is for 2.6.20-rc1. 
> 
> Please apply.
> 
> Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

after also using the register_memory() patch.


> ---
>  arch/i386/mm/discontig.c |   28 ++++++++++++++++++++++++++++
>  arch/i386/mm/init.c      |   10 ++--------
>  2 files changed, 30 insertions(+), 8 deletions(-)
> 
> Index: linux-2.6.20-rc1/arch/i386/mm/init.c
> ===================================================================
> --- linux-2.6.20-rc1.orig/arch/i386/mm/init.c	2006-12-20 22:12:07.000000000 +0900
> +++ linux-2.6.20-rc1/arch/i386/mm/init.c	2006-12-20 22:12:09.000000000 +0900
> @@ -673,16 +673,10 @@
>  #endif
>  }
>  
> -/*
> - * this is for the non-NUMA, single node SMP system case.
> - * Specifically, in the case of x86, we will always add
> - * memory to the highmem for now.
> - */
>  #ifdef CONFIG_MEMORY_HOTPLUG
> -#ifndef CONFIG_NEED_MULTIPLE_NODES
>  int arch_add_memory(int nid, u64 start, u64 size)
>  {
> -	struct pglist_data *pgdata = &contig_page_data;
> +	struct pglist_data *pgdata = NODE_DATA(nid);
>  	struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
>  	unsigned long start_pfn = start >> PAGE_SHIFT;
>  	unsigned long nr_pages = size >> PAGE_SHIFT;
> @@ -694,7 +688,7 @@
>  {
>  	return -EINVAL;
>  }
> -#endif
> +EXPORT_SYMBOL_GPL(remove_memory);
>  #endif
>  
>  struct kmem_cache *pgd_cache;
> Index: linux-2.6.20-rc1/arch/i386/mm/discontig.c
> ===================================================================
> --- linux-2.6.20-rc1.orig/arch/i386/mm/discontig.c	2006-12-20 22:12:07.000000000 +0900
> +++ linux-2.6.20-rc1/arch/i386/mm/discontig.c	2006-12-20 22:37:54.000000000 +0900
> @@ -405,3 +405,31 @@
>  	totalram_pages += totalhigh_pages;
>  #endif
>  }
> +
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +int paddr_to_nid(u64 addr)
> +{
> +	int nid;
> +	unsigned long pfn = PFN_DOWN(addr);
> +
> +	for_each_node(nid)
> +		if (node_start_pfn[nid] <= pfn &&
> +		    pfn < node_end_pfn[nid])
> +			return nid;
> +
> +	return -1;
> +}
> +
> +/*
> + * This function is used to ask node id BEFORE memmap and mem_section's
> + * initialization (pfn_to_nid() can't be used yet).
> + * If _PXM is not defined on ACPI's DSDT, node id must be found by this.
> + */
> +int memory_add_physaddr_to_nid(u64 addr)
> +{
> +	int nid = paddr_to_nid(addr);
> +	return (nid >= 0) ? nid : 0;
> +}
> +
> +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
> +#endif
> 
> -- 

---
~Randy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3).
  2006-12-20 14:09 [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3) Yasunori Goto
  2006-12-20 17:15 ` David Rientjes
  2006-12-21  0:27 ` Randy Dunlap
@ 2006-12-21  5:09 ` Andrew Morton
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2006-12-21  5:09 UTC (permalink / raw)
  To: Yasunori Goto; +Cc: David Rientjes, Linux Kernel ML, Andi Kleen, Randy Dunlap

On Wed, 20 Dec 2006 23:09:58 +0900
Yasunori Goto <y-goto@jp.fujitsu.com> wrote:

> +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);

Exported to acpi_memhotplug, I guess.

Is not actually needed on NUMAQ.   I don't think anyone will
complain much ;)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-12-21  5:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-20 14:09 [Patch](memory hotplug) fix compile error for i386 with NUMA config (take 3) Yasunori Goto
2006-12-20 17:15 ` David Rientjes
2006-12-21  0:27 ` Randy Dunlap
2006-12-21  5:09 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).