Commit ac13c4622bda2a9ff8f57bbbfeff48b2a42d0963

Authored by Nathan Zimmer
Committed by Linus Torvalds
1 parent 354f17e1e2

mm/memory_hotplug.c: move register_memory_resource out of the lock_memory_hotplug

We don't need to do register_memory_resource() under
lock_memory_hotplug() 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: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Cc: Hedi <hedi@sgi.com>
Cc: Mike Travis <travis@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 4 additions and 3 deletions Side-by-side Diff

... ... @@ -1107,17 +1107,18 @@
1107 1107 if (ret)
1108 1108 return ret;
1109 1109  
1110   - lock_memory_hotplug();
1111   -
1112 1110 res = register_memory_resource(start, size);
1113 1111 ret = -EEXIST;
1114 1112 if (!res)
1115   - goto out;
  1113 + return ret;
1116 1114  
1117 1115 { /* Stupid hack to suppress address-never-null warning */
1118 1116 void *p = NODE_DATA(nid);
1119 1117 new_pgdat = !p;
1120 1118 }
  1119 +
  1120 + lock_memory_hotplug();
  1121 +
1121 1122 new_node = !node_online(nid);
1122 1123 if (new_node) {
1123 1124 pgdat = hotadd_new_pgdat(nid, start);