From 883e532e2139975bee0e78bf4f5539ebed04f2e8 Mon Sep 17 00:00:00 2001 From: Yasunori Goto Date: Fri, 22 Dec 2006 01:11:13 -0800 Subject: [PATCH] --- yaml --- r: 44907 b: refs/heads/master c: 7c7e9425f114a109b07be2c2c1c6c169e34e9bb3 h: refs/heads/master i: 44905: f7979d7b5260cac26192ead61822954536b40a0b 44903: 734aa9e9dc0bc45200c095a47b63b16ee877b4c9 v: v3 --- [refs] | 2 +- trunk/arch/i386/mm/discontig.c | 28 ++++++++++++++++++++++++++++ trunk/arch/i386/mm/init.c | 10 ++-------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 86d79a35c0a3..c6870a86966b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 080dd51d81c8a9373303e9c344bbc75aacf54dce +refs/heads/master: 7c7e9425f114a109b07be2c2c1c6c169e34e9bb3 diff --git a/trunk/arch/i386/mm/discontig.c b/trunk/arch/i386/mm/discontig.c index 103b76e56a94..e0c390d6ceb5 100644 --- a/trunk/arch/i386/mm/discontig.c +++ b/trunk/arch/i386/mm/discontig.c @@ -405,3 +405,31 @@ void __init set_highmem_pages_init(int bad_ppro) totalram_pages += totalhigh_pages; #endif } + +#ifdef CONFIG_MEMORY_HOTPLUG +int paddr_to_nid(u64 addr) +{ + int nid; + unsigned long pfn = PFN_DOWN(addr); + + for_each_node(nid) + if (node_start_pfn[nid] <= pfn && + pfn < node_end_pfn[nid]) + return nid; + + return -1; +} + +/* + * This function is used to ask node id BEFORE memmap and mem_section's + * initialization (pfn_to_nid() can't be used yet). + * If _PXM is not defined on ACPI's DSDT, node id must be found by this. + */ +int memory_add_physaddr_to_nid(u64 addr) +{ + int nid = paddr_to_nid(addr); + return (nid >= 0) ? nid : 0; +} + +EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid); +#endif diff --git a/trunk/arch/i386/mm/init.c b/trunk/arch/i386/mm/init.c index 84697dfc7348..60a7e57af197 100644 --- a/trunk/arch/i386/mm/init.c +++ b/trunk/arch/i386/mm/init.c @@ -673,16 +673,10 @@ void __init mem_init(void) #endif } -/* - * this is for the non-NUMA, single node SMP system case. - * Specifically, in the case of x86, we will always add - * memory to the highmem for now. - */ #ifdef CONFIG_MEMORY_HOTPLUG -#ifndef CONFIG_NEED_MULTIPLE_NODES int arch_add_memory(int nid, u64 start, u64 size) { - struct pglist_data *pgdata = &contig_page_data; + struct pglist_data *pgdata = NODE_DATA(nid); struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; @@ -694,7 +688,7 @@ int remove_memory(u64 start, u64 size) { return -EINVAL; } -#endif +EXPORT_SYMBOL_GPL(remove_memory); #endif struct kmem_cache *pgd_cache;