* [RFC/PATCH: 004/010] Memory hotplug for new nodes with pgdat allocation. (pgdat alloc caller for x86_64)
@ 2006-02-10 14:21 Yasunori Goto
2006-02-10 17:15 ` [discuss] " Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Yasunori Goto @ 2006-02-10 14:21 UTC (permalink / raw)
To: Andi Kleen, Luck, Tony, Tolentino, Matthew E
Cc: Linux Kernel ML, linux-ia64, x86-64 Discuss,
Linux Hotplug Memory Support
This is sample code of calling pgdat allocation function for x86_64.
Basically it is same with ia64.
I've not tried this patch yet, due to I couldn't make emulation for
new node addtion for x86_64. This is just to reference. :-P
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Index: pgdat2/arch/x86_64/mm/init.c
===================================================================
--- pgdat2.orig/arch/x86_64/mm/init.c 2006-02-10 17:29:20.000000000 +0900
+++ pgdat2/arch/x86_64/mm/init.c 2006-02-10 17:30:42.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,25 @@ 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, new_pgdat = 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)
+ goto err;
+ new_pgdat = 1;
+ }
+
ret = __add_pages(zone, start_pfn, nr_pages);
if (ret)
@@ -509,6 +524,9 @@ int add_memory(u64 start, u64 size)
return ret;
error:
printk("%s: Problem encountered in __add_pages!\n", __func__);
+ if (new_pgdat)
+ release_pgdat(ret);
+
return ret;
}
EXPORT_SYMBOL_GPL(add_memory);
--
Yasunori Goto
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [discuss] [RFC/PATCH: 004/010] Memory hotplug for new nodes with pgdat allocation. (pgdat alloc caller for x86_64)
2006-02-10 14:21 [RFC/PATCH: 004/010] Memory hotplug for new nodes with pgdat allocation. (pgdat alloc caller for x86_64) Yasunori Goto
@ 2006-02-10 17:15 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2006-02-10 17:15 UTC (permalink / raw)
To: discuss
Cc: Yasunori Goto, Luck, Tony, Tolentino, Matthew E, Linux Kernel ML,
linux-ia64, Linux Hotplug Memory Support
On Friday 10 February 2006 15:21, Yasunori Goto wrote:
> This is sample code of calling pgdat allocation function for x86_64.
> Basically it is same with ia64.
>
> I've not tried this patch yet, due to I couldn't make emulation for
> new node addtion for x86_64. This is just to reference. :-P
Looks ok basically assuming someone tests it
(I guess it would be possible to hack the numa emulation to support
hotplug)
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-10 17:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-10 14:21 [RFC/PATCH: 004/010] Memory hotplug for new nodes with pgdat allocation. (pgdat alloc caller for x86_64) Yasunori Goto
2006-02-10 17:15 ` [discuss] " Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox