Memory hotplug for new nodes v.2. (pgdat alloc caller for ia64)
PATCH 4/12 Memory hotplug for new nodes v.2. (pgdat alloc caller for ia64)
This is caller of pgdat allocation for ia64.
If new memory belongs to new nodes, pgdat is allocated...
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;
}
Signature · 1 line
Yasunori Goto
Review
Quoted 13 lines · Yasunori Goto
(quoted diff) +12
-0+ 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