aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nobootmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/nobootmem.c')
-rw-r--r--mm/nobootmem.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index ecc2f13d557d..03d152a76acf 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -137,6 +137,22 @@ unsigned long __init free_low_memory_core_early(int nodeid)
137 return count; 137 return count;
138} 138}
139 139
140static void reset_node_lowmem_managed_pages(pg_data_t *pgdat)
141{
142 struct zone *z;
143
144 /*
145 * In free_area_init_core(), highmem zone's managed_pages is set to
146 * present_pages, and bootmem allocator doesn't allocate from highmem
147 * zones. So there's no need to recalculate managed_pages because all
148 * highmem pages will be managed by the buddy system. Here highmem
149 * zone also includes highmem movable zone.
150 */
151 for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
152 if (!is_highmem(z))
153 z->managed_pages = 0;
154}
155
140/** 156/**
141 * free_all_bootmem - release free pages to the buddy allocator 157 * free_all_bootmem - release free pages to the buddy allocator
142 * 158 *
@@ -144,6 +160,11 @@ unsigned long __init free_low_memory_core_early(int nodeid)
144 */ 160 */
145unsigned long __init free_all_bootmem(void) 161unsigned long __init free_all_bootmem(void)
146{ 162{
163 struct pglist_data *pgdat;
164
165 for_each_online_pgdat(pgdat)
166 reset_node_lowmem_managed_pages(pgdat);
167
147 /* 168 /*
148 * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id 169 * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id
149 * because in some case like Node0 doesn't have RAM installed 170 * because in some case like Node0 doesn't have RAM installed