Commit 7c7e9425 authored by Yasunori Goto's avatar Yasunori Goto Committed by Linus Torvalds

[PATCH] memory hotplug: fix compile error for i386 with NUMA config

Fix compile error when config memory hotplug with numa on i386.

The cause of compile error was missing of arch_add_memory(),
remove_memory(), and memory_add_physaddr_to_nid().
Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
Acked-by: default avatarDavid Rientjes <rientjes@cs.washington.edu>
Acked-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 080dd51d
...@@ -405,3 +405,31 @@ void __init set_highmem_pages_init(int bad_ppro) ...@@ -405,3 +405,31 @@ void __init set_highmem_pages_init(int bad_ppro)
totalram_pages += totalhigh_pages; totalram_pages += totalhigh_pages;
#endif #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
...@@ -673,16 +673,10 @@ void __init mem_init(void) ...@@ -673,16 +673,10 @@ void __init mem_init(void)
#endif #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 #ifdef CONFIG_MEMORY_HOTPLUG
#ifndef CONFIG_NEED_MULTIPLE_NODES
int arch_add_memory(int nid, u64 start, u64 size) 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; struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT;
...@@ -694,7 +688,7 @@ int remove_memory(u64 start, u64 size) ...@@ -694,7 +688,7 @@ int remove_memory(u64 start, u64 size)
{ {
return -EINVAL; return -EINVAL;
} }
#endif EXPORT_SYMBOL_GPL(remove_memory);
#endif #endif
struct kmem_cache *pgd_cache; struct kmem_cache *pgd_cache;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment