diff options
author | Keith Mannthey <kmannth@us.ibm.com> | 2006-10-01 02:27:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:18 -0400 |
commit | 45e0b78b0532f92c01e363dd4287617c5be4574f (patch) | |
tree | 8c09edff4667535252b5c95efd68d397ae1283a5 /mm/memory_hotplug.c | |
parent | 53947027ad90542ddb2bb746e3175827c270610a (diff) |
[PATCH] hot-add-mem x86_64: use CONFIG_MEMORY_HOTPLUG_RESERVE
The api for hot-add memory already has a construct for finding nodes based on
an address, memory_add_physaddr_to_nid. This patch allows the fucntion to do
something besides return 0. It uses the nodes_add infomation to lookup to
node info for a hot add event.
Signed-off-by: Keith Mannthey <kmannth@us.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r-- | mm/memory_hotplug.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 7666dbd328df..fd678a662eae 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -26,6 +26,36 @@ | |||
26 | 26 | ||
27 | #include <asm/tlbflush.h> | 27 | #include <asm/tlbflush.h> |
28 | 28 | ||
29 | /* add this memory to iomem resource */ | ||
30 | static struct resource *register_memory_resource(u64 start, u64 size) | ||
31 | { | ||
32 | struct resource *res; | ||
33 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
34 | BUG_ON(!res); | ||
35 | |||
36 | res->name = "System RAM"; | ||
37 | res->start = start; | ||
38 | res->end = start + size - 1; | ||
39 | res->flags = IORESOURCE_MEM; | ||
40 | if (request_resource(&iomem_resource, res) < 0) { | ||
41 | printk("System RAM resource %llx - %llx cannot be added\n", | ||
42 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
43 | kfree(res); | ||
44 | res = NULL; | ||
45 | } | ||
46 | return res; | ||
47 | } | ||
48 | |||
49 | static void release_memory_resource(struct resource *res) | ||
50 | { | ||
51 | if (!res) | ||
52 | return; | ||
53 | release_resource(res); | ||
54 | kfree(res); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | |||
29 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE | 59 | #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE |
30 | static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) | 60 | static int __add_zone(struct zone *zone, unsigned long phys_start_pfn) |
31 | { | 61 | { |
@@ -223,36 +253,6 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) | |||
223 | return; | 253 | return; |
224 | } | 254 | } |
225 | 255 | ||
226 | /* add this memory to iomem resource */ | ||
227 | static struct resource *register_memory_resource(u64 start, u64 size) | ||
228 | { | ||
229 | struct resource *res; | ||
230 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
231 | BUG_ON(!res); | ||
232 | |||
233 | res->name = "System RAM"; | ||
234 | res->start = start; | ||
235 | res->end = start + size - 1; | ||
236 | res->flags = IORESOURCE_MEM; | ||
237 | if (request_resource(&iomem_resource, res) < 0) { | ||
238 | printk("System RAM resource %llx - %llx cannot be added\n", | ||
239 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
240 | kfree(res); | ||
241 | res = NULL; | ||
242 | } | ||
243 | return res; | ||
244 | } | ||
245 | |||
246 | static void release_memory_resource(struct resource *res) | ||
247 | { | ||
248 | if (!res) | ||
249 | return; | ||
250 | release_resource(res); | ||
251 | kfree(res); | ||
252 | return; | ||
253 | } | ||
254 | |||
255 | |||
256 | 256 | ||
257 | int add_memory(int nid, u64 start, u64 size) | 257 | int add_memory(int nid, u64 start, u64 size) |
258 | { | 258 | { |