Commit 0a547039 authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

[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: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9af3c2de
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/memory_hotplug.h> #include <linux/memory_hotplug.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/ioport.h>
#include <asm/tlbflush.h> #include <asm/tlbflush.h>
...@@ -192,6 +193,27 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat) ...@@ -192,6 +193,27 @@ static void rollback_node_hotadd(int nid, pg_data_t *pgdat)
return; return;
} }
/* add this memory to iomem resource */
static void register_memory_resource(u64 start, u64 size)
{
struct resource *res;
res = kzalloc(sizeof(struct resource), GFP_KERNEL);
BUG_ON(!res);
res->name = "System RAM";
res->start = start;
res->end = start + size - 1;
res->flags = IORESOURCE_MEM;
if (request_resource(&iomem_resource, res) < 0) {
printk("System RAM resource %llx - %llx cannot be added\n",
(unsigned long long)res->start, (unsigned long long)res->end);
kfree(res);
}
}
int add_memory(int nid, u64 start, u64 size) int add_memory(int nid, u64 start, u64 size)
{ {
pg_data_t *pgdat = NULL; pg_data_t *pgdat = NULL;
...@@ -217,6 +239,9 @@ int add_memory(int nid, u64 start, u64 size) ...@@ -217,6 +239,9 @@ int add_memory(int nid, u64 start, u64 size)
/* we online node here. we have no error path from here. */ /* we online node here. we have no error path from here. */
node_set_online(nid); node_set_online(nid);
/* register this memory as resource */
register_memory_resource(start, size);
return ret; return ret;
error: error:
/* rollback pgdat allocation and others */ /* rollback pgdat allocation and others */
......
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