public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat alloc caller for ia64)
@ 2006-02-17 13:28 Yasunori Goto
  2006-02-17 15:52 ` [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat Dave Hansen
  0 siblings, 1 reply; 2+ messages in thread
From: Yasunori Goto @ 2006-02-17 13:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Luck, Tony, Andi Kleen, Tolentino, Matthew E, Joel Schopp,
	Dave Hansen, linux-ia64, Linux Kernel ML, x86-64 Discuss

This is caller of pgdat allocation for ia64.
If new memory belongs to new nodes, pgdat is allocated...

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

Index: pgdat3/arch/ia64/mm/init.c
=================================--- pgdat3.orig/arch/ia64/mm/init.c	2006-02-17 15:51:04.000000000 +0900
+++ pgdat3/arch/ia64/mm/init.c	2006-02-17 16:14:59.000000000 +0900
@@ -20,6 +20,7 @@
 #include <linux/swap.h>
 #include <linux/proc_fs.h>
 #include <linux/bitops.h>
+#include <linux/acpi.h>
 
 #include <asm/a.out.h>
 #include <asm/dma.h>
@@ -652,16 +653,32 @@ int add_memory(u64 start, u64 size)
 	struct zone *zone;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
-	int ret;
+	int ret, node, new_pgdat = 0;
 
-	pgdat = NODE_DATA(0);
+	node = acpi_paddr_to_node(start, size);
+
+	if (node < 0)
+	        node = 0; /* pxm is undefined in DSDT.
+			     This might be non NUMA case */
+
+	if (!node_online(node)){
+		ret = new_pgdat_init(node, start_pfn, nr_pages);
+		if (ret)
+			return ret;
+
+		new_pgdat = 1;
+	}
+	pgdat = NODE_DATA(node);
 
 	zone = pgdat->node_zones + ZONE_NORMAL;
 	ret = __add_pages(zone, start_pfn, nr_pages);
 
-	if (ret)
+	if (ret){
 		printk("%s: Problem encountered in __add_pages() as ret=%d\n",
 		       __FUNCTION__,  ret);
+		if (new_pgdat)
+			release_pgdat(pgdat);
+	}
 
 	return ret;
 }

-- 
Yasunori Goto 



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

* Re: [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat
  2006-02-17 13:28 [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat alloc caller for ia64) Yasunori Goto
@ 2006-02-17 15:52 ` Dave Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2006-02-17 15:52 UTC (permalink / raw)
  To: Yasunori Goto
  Cc: Andrew Morton, Luck, Tony, Andi Kleen, Tolentino, Matthew E,
	Joel Schopp, linux-ia64, Linux Kernel ML, x86-64 Discuss

On Fri, 2006-02-17 at 22:28 +0900, Yasunori Goto wrote:
> 
> +       if (node < 0)
> +               node = 0; /* pxm is undefined in DSDT.
> +                            This might be non NUMA case */
> +
> +       if (!node_online(node)){
> +               ret = new_pgdat_init(node, start_pfn, nr_pages);
> +               if (ret)
> +                       return ret;
> +
> +               new_pgdat = 1;
> +       }
> +       pgdat = NODE_DATA(node); 

Now that I've seen this exact code copy-and-pasted into two different
architectures, it begs the question: do we need a common function here?

-- Dave


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

end of thread, other threads:[~2006-02-17 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-17 13:28 [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat alloc caller for ia64) Yasunori Goto
2006-02-17 15:52 ` [PATCH: 004/012] Memory hotplug for new nodes v.2. (pgdat Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox