[RFC:PATCH(003/003)] Memory add to onlined node. (ver. 2) (For x86_64)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is for x86_64 to add memory which belongs onlined node.

Signed-off-by: Yasunori Goto <[email protected]>

Index: node_simple3/arch/x86_64/mm/init.c
===================================================================
--- node_simple3.orig/arch/x86_64/mm/init.c	2006-02-09 12:01:47.000000000 +0900
+++ node_simple3/arch/x86_64/mm/init.c	2006-02-09 14:09:11.000000000 +0900
@@ -26,6 +26,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/memory_hotplug.h>
+#include <linux/acpi.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -494,11 +495,20 @@ void online_page(struct page *page)
 
 int add_memory(u64 start, u64 size)
 {
-	struct pglist_data *pgdat = NODE_DATA(0);
-	struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
+	struct pglist_data *pgdat;
+	struct zone *zone;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
-	int ret;
+	int ret, node;
+
+	node = acpi_paddr_to_node(start, size);
+	if (node >= 0 && node_online(node))
+		pgdat = NODE_DATA(node);
+	else
+		/* New node's memory will be added to Node 0 temporally. */
+		pgdat = NODE_DATA(0);
+
+	zone = pgdat->node_zones + MAX_NR_ZONES - 2;
 
 	ret = __add_pages(zone, start_pfn, nr_pages);
 	if (ret)

-- 
Yasunori Goto 


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux