public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] register hot-added memory to iomem resource
@ 2006-04-27 11:49 KAMEZAWA Hiroyuki
  2006-04-27 16:10 ` [Lhms-devel] " jschopp
  2006-04-27 23:01 ` Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-04-27 11:49 UTC (permalink / raw)
  To: LKML; +Cc: LHMS, Andrew Morton

This patch registers hot-added memory to iomem_resource.
By this, /proc/iomem can show hot-added memory.
This patch is against 2.6.17-rc2-mm1.

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>

Index: linux-2.6.17-rc2-mm1/mm/memory_hotplug.c
===================================================================
--- linux-2.6.17-rc2-mm1.orig/mm/memory_hotplug.c	2006-04-27 18:00:17.000000000 +0900
+++ linux-2.6.17-rc2-mm1/mm/memory_hotplug.c	2006-04-27 20:21:32.000000000 +0900
@@ -21,6 +21,7 @@
 #include <linux/memory_hotplug.h>
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
+#include <linux/ioport.h>
 
 #include <asm/tlbflush.h>
 
@@ -188,6 +189,27 @@
 	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)
 {
 	pg_data_t *pgdat = NULL;
@@ -213,6 +235,9 @@
 	/* we online node here. we have no error path from here. */
 	node_set_online(nid);
 
+	/* register this memory as resource */
+	register_memory_resource(start, size);
+
 	return ret;
 error:
 	/* rollback pgdat allocation and others */


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-04-29  0:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-27 11:49 [PATCH] register hot-added memory to iomem resource KAMEZAWA Hiroyuki
2006-04-27 16:10 ` [Lhms-devel] " jschopp
2006-04-28  0:47   ` KAMEZAWA Hiroyuki
2006-04-27 23:01 ` Andrew Morton
2006-04-28  0:27   ` [Lhms-devel] " KAMEZAWA Hiroyuki
2006-04-28 14:50     ` Vivek Goyal
2006-04-28 18:43     ` Vivek Goyal
2006-04-29  0:18       ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox