diff options
author | Wei Yang <richard.weiyang@gmail.com> | 2017-09-06 19:19:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-06 20:27:25 -0400 |
commit | c11525830f92dea58353ace0f074ece5d9ef37c8 (patch) | |
tree | 02b6f2a03dc2384e29a16994ff4eac22bb34a5f4 /mm/page_alloc.c | |
parent | 912d572d63b8cd19c303f357b627de492bd6bdef (diff) |
mm/memory_hotplug: just build zonelist for newly added node
Commit 9adb62a5df9c ("mm/hotplug: correctly setup fallback zonelists
when creating new pgdat") tries to build the correct zonelist for a
newly added node, while it is not necessary to rebuild it for already
exist nodes.
In build_zonelists(), it will iterate on nodes with memory. For a newly
added node, it will have memory until node_states_set_node() is called
in online_pages().
This patch avoids rebuilding the zonelists for already existing nodes.
build_zonelists_node() uses managed_zone(zone) checks, so it should not
include empty zones anyway. So effectively we avoid some pointless work
under stop_machine().
[akpm@linux-foundation.org: tweak comment text]
[akpm@linux-foundation.org: coding-style tweak, per Vlastimil]
Link: http://lkml.kernel.org/r/20170626035822.50155-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9327a940e373..dcc8a1cf55b6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5282,14 +5282,18 @@ static int __build_all_zonelists(void *data) | |||
5282 | memset(node_load, 0, sizeof(node_load)); | 5282 | memset(node_load, 0, sizeof(node_load)); |
5283 | #endif | 5283 | #endif |
5284 | 5284 | ||
5285 | /* | ||
5286 | * This node is hotadded and no memory is yet present. So just | ||
5287 | * building zonelists is fine - no need to touch other nodes. | ||
5288 | */ | ||
5285 | if (self && !node_online(self->node_id)) { | 5289 | if (self && !node_online(self->node_id)) { |
5286 | build_zonelists(self); | 5290 | build_zonelists(self); |
5287 | } | 5291 | } else { |
5288 | 5292 | for_each_online_node(nid) { | |
5289 | for_each_online_node(nid) { | 5293 | pg_data_t *pgdat = NODE_DATA(nid); |
5290 | pg_data_t *pgdat = NODE_DATA(nid); | ||
5291 | 5294 | ||
5292 | build_zonelists(pgdat); | 5295 | build_zonelists(pgdat); |
5296 | } | ||
5293 | } | 5297 | } |
5294 | 5298 | ||
5295 | /* | 5299 | /* |