Commit 1e8537baacd59e96bbe5f8d3d32feafd11f509fe

Authored by Xishi Qiu
Committed by Linus Torvalds
1 parent 38a76013ad

memory-hotplug: build zonelists when offlining pages

online_pages() does build_all_zonelists() and zone_pcp_update(), I think
offline_pages() should do it too.

When the zone has no memory to allocate, remove it from other nodes'
zonelists.  zone_batchsize() depends on zone's present pages, if zone's
present pages are changed, zone's pcp should be updated.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

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

... ... @@ -970,8 +970,13 @@
970 970  
971 971 init_per_zone_wmark_min();
972 972  
973   - if (!populated_zone(zone))
  973 + if (!populated_zone(zone)) {
974 974 zone_pcp_reset(zone);
  975 + mutex_lock(&zonelists_mutex);
  976 + build_all_zonelists(NULL, NULL);
  977 + mutex_unlock(&zonelists_mutex);
  978 + } else
  979 + zone_pcp_update(zone);
975 980  
976 981 if (!node_present_pages(node)) {
977 982 node_clear_state(node, N_HIGH_MEMORY);