[RFC] hotplug, memory: move register_memory_resource out of the lock_memory_hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't need to do register_memory_resource() since it has its own lock and
doesn't make any callbacks.

Also register_memory_resource return NULL on failure so we don't have anything
to cleanup at this point.


The reason for this rfc is I was doing some experiments with hotplugging of
memory on some of our larger systems.  While it seems to work, it can be quite
slow.  With some preliminary digging I found that lock_memory_hotplug is
clearly ripe for breakup.

It could be broken up per nid or something but it also covers the
online_page_callback.  The online_page_callback shouldn't be very hard to break
out.

Also there is the issue of various structures(wmarks come to mind) that are
only updated under the lock_memory_hotplug that would need to be dealt with.


cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
cc: Tang Chen <tangchen@xxxxxxxxxxxxxx>
cc: Wen Congyang <wency@xxxxxxxxxxxxxx>
cc: Kamezawa Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
cc: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
cc: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
cc: Hedi <hedi@xxxxxxx>
cc: Mike Travis <travis@xxxxxxx>
cc: linux-mm@xxxxxxxxx
cc: linux-kernel@xxxxxxxxxxxxxxx


---
 mm/memory_hotplug.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 1ad92b4..62a0cd1 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1097,17 +1097,18 @@ int __ref add_memory(int nid, u64 start, u64 size)
 	struct resource *res;
 	int ret;
 
-	lock_memory_hotplug();
-
 	res = register_memory_resource(start, size);
 	ret = -EEXIST;
 	if (!res)
-		goto out;
+		return ret;
 
 	{	/* Stupid hack to suppress address-never-null warning */
 		void *p = NODE_DATA(nid);
 		new_pgdat = !p;
 	}
+
+	lock_memory_hotplug();
+
 	new_node = !node_online(nid);
 	if (new_node) {
 		pgdat = hotadd_new_pgdat(nid, start);
-- 
1.8.2.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]