Merge remote-tracking branch 'origin/x86/boot' into x86/mm2
[sfrench/cifs-2.6.git] / mm / nobootmem.c
index ecc2f13d557d3b28f5bb82b3d5dca2e621cfcf9c..03d152a76acf5e18396b74e62a3372e55b469750 100644 (file)
@@ -137,6 +137,22 @@ unsigned long __init free_low_memory_core_early(int nodeid)
        return count;
 }
 
+static void reset_node_lowmem_managed_pages(pg_data_t *pgdat)
+{
+       struct zone *z;
+
+       /*
+        * In free_area_init_core(), highmem zone's managed_pages is set to
+        * present_pages, and bootmem allocator doesn't allocate from highmem
+        * zones. So there's no need to recalculate managed_pages because all
+        * highmem pages will be managed by the buddy system. Here highmem
+        * zone also includes highmem movable zone.
+        */
+       for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++)
+               if (!is_highmem(z))
+                       z->managed_pages = 0;
+}
+
 /**
  * free_all_bootmem - release free pages to the buddy allocator
  *
@@ -144,6 +160,11 @@ unsigned long __init free_low_memory_core_early(int nodeid)
  */
 unsigned long __init free_all_bootmem(void)
 {
+       struct pglist_data *pgdat;
+
+       for_each_online_pgdat(pgdat)
+               reset_node_lowmem_managed_pages(pgdat);
+
        /*
         * We need to use MAX_NUMNODES instead of NODE_DATA(0)->node_id
         *  because in some case like Node0 doesn't have RAM installed