* [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc caller for x86-64)
@ 2006-02-17 13:29 Yasunori Goto
2006-02-17 15:51 ` [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc Dave Hansen
0 siblings, 1 reply; 2+ messages in thread
From: Yasunori Goto @ 2006-02-17 13:29 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 code for calling pgdat allocation function for x86_64.
Basically it is same with ia64.
But, decision of ZONE_DMA32 or ZONE_NORMAL is necessary.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Index: linux-2.6.15/arch/x86_64/mm/init.c
=================================--- linux-2.6.15.orig/arch/x86_64/mm/init.c 2006-02-16 20:21:29.000000000 +0900
+++ linux-2.6.15/arch/x86_64/mm/init.c 2006-02-16 21:34:29.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,12 +495,27 @@
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 zone *zone;
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
- int ret;
+ int ret, node, zone_type, 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 error;
+ new_pgdat = 1;
+ }
+
+ zone_type = start_pfn < MAX_DMA32_PFN ?
+ ZONE_DMA32 : ZONE_NORMAL;
+ zone = NODE_DATA(node)->node_zones + zone_type;
ret = __add_pages(zone, start_pfn, nr_pages);
if (ret)
goto error;
@@ -509,6 +525,9 @@
return ret;
error:
printk("%s: Problem encountered in __add_pages!\n", __func__);
+ if (new_pgdat)
+ release_pgdat(NODE_DATA(node));
+
return ret;
}
EXPORT_SYMBOL_GPL(add_memory);
--
Yasunori Goto
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc
2006-02-17 13:29 [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc caller for x86-64) Yasunori Goto
@ 2006-02-17 15:51 ` Dave Hansen
0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2006-02-17 15:51 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:29 +0900, Yasunori Goto wrote:
> + zone_type = start_pfn < MAX_DMA32_PFN ?
> + ZONE_DMA32 : ZONE_NORMAL;
Please change this to something which we can more easily parse, such as
this:
if (start_pfn < MAX_DMA32_PFN)
zone_type = ZONE_DMA32;
else
zone_type = ZONE_NORMAL;
I think it is worth the extra two lines.
-- Dave
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-17 15:51 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:29 [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc caller for x86-64) Yasunori Goto
2006-02-17 15:51 ` [PATCH: 005/012] Memory hotplug for new nodes v.2.(pgdat alloc Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox