aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory_hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/memory_hotplug.c')
-rw-r--r--mm/memory_hotplug.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 71da5c98c9c1..1b1ac3db2187 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -127,6 +127,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
127 unsigned long flags; 127 unsigned long flags;
128 unsigned long onlined_pages = 0; 128 unsigned long onlined_pages = 0;
129 struct zone *zone; 129 struct zone *zone;
130 int need_zonelists_rebuild = 0;
130 131
131 /* 132 /*
132 * This doesn't need a lock to do pfn_to_page(). 133 * This doesn't need a lock to do pfn_to_page().
@@ -139,6 +140,14 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
139 grow_pgdat_span(zone->zone_pgdat, pfn, pfn + nr_pages); 140 grow_pgdat_span(zone->zone_pgdat, pfn, pfn + nr_pages);
140 pgdat_resize_unlock(zone->zone_pgdat, &flags); 141 pgdat_resize_unlock(zone->zone_pgdat, &flags);
141 142
143 /*
144 * If this zone is not populated, then it is not in zonelist.
145 * This means the page allocator ignores this zone.
146 * So, zonelist must be updated after online.
147 */
148 if (!populated_zone(zone))
149 need_zonelists_rebuild = 1;
150
142 for (i = 0; i < nr_pages; i++) { 151 for (i = 0; i < nr_pages; i++) {
143 struct page *page = pfn_to_page(pfn + i); 152 struct page *page = pfn_to_page(pfn + i);
144 online_page(page); 153 online_page(page);
@@ -149,5 +158,8 @@ int online_pages(unsigned long pfn, unsigned long nr_pages)
149 158
150 setup_per_zone_pages_min(); 159 setup_per_zone_pages_min();
151 160
161 if (need_zonelists_rebuild)
162 build_all_zonelists();
163
152 return 0; 164 return 0;
153} 165}