diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2006-06-27 05:53:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-27 20:32:36 -0400 |
commit | 0a54703904a4a206686b4e8c3f5a6927b60747aa (patch) | |
tree | 2aa373cdd78094666d9cdf526391235a65afaee8 | |
parent | 9af3c2dea3a3ae4248d81a70b556adfe1dc65d55 (diff) |
[PATCH] register hot-added memory to iomem resource
Register hot-added memory to iomem_resource. With this, /proc/iomem can
show hot-added memory.
Note: kdump uses /proc/iomem to catch memory range when it is installed.
So, kdump should be re-installed after /proc/iomem change.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/memory_hotplug.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 83d37a401b3b..0b11a8543441 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/memory_hotplug.h> | 21 | #include <linux/memory_hotplug.h> |
22 | #include <linux/highmem.h> | 22 | #include <linux/highmem.h> |
23 | #include <linux/vmalloc.h> | 23 | #include <linux/vmalloc.h> |
24 | #include <linux/ioport.h> | ||
24 | 25 | ||
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
26 | 27 | ||
@@ -192,6 +193,27 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) | |||
192 | return; | 193 | return; |
193 | } | 194 | } |
194 | 195 | ||
196 | /* add this memory to iomem resource */ | ||
197 | static void register_memory_resource(u64 start, u64 size) | ||
198 | { | ||
199 | struct resource *res; | ||
200 | |||
201 | res = kzalloc(sizeof(struct resource), GFP_KERNEL); | ||
202 | BUG_ON(!res); | ||
203 | |||
204 | res->name = "System RAM"; | ||
205 | res->start = start; | ||
206 | res->end = start + size - 1; | ||
207 | res->flags = IORESOURCE_MEM; | ||
208 | if (request_resource(&iomem_resource, res) < 0) { | ||
209 | printk("System RAM resource %llx - %llx cannot be added\n", | ||
210 | (unsigned long long)res->start, (unsigned long long)res->end); | ||
211 | kfree(res); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | |||
216 | |||
195 | int add_memory(int nid, u64 start, u64 size) | 217 | int add_memory(int nid, u64 start, u64 size) |
196 | { | 218 | { |
197 | pg_data_t *pgdat = NULL; | 219 | pg_data_t *pgdat = NULL; |
@@ -217,6 +239,9 @@ int add_memory(int nid, u64 start, u64 size) | |||
217 | /* we online node here. we have no error path from here. */ | 239 | /* we online node here. we have no error path from here. */ |
218 | node_set_online(nid); | 240 | node_set_online(nid); |
219 | 241 | ||
242 | /* register this memory as resource */ | ||
243 | register_memory_resource(start, size); | ||
244 | |||
220 | return ret; | 245 | return ret; |
221 | error: | 246 | error: |
222 | /* rollback pgdat allocation and others */ | 247 | /* rollback pgdat allocation and others */ |