OSDN Git Service

mm: reference totalram_pages and managed_pages once per function
[uclinux-h8/linux.git] / mm / page_alloc.c
index c82c41e..b79e79c 100644 (file)
@@ -7257,6 +7257,7 @@ static void calculate_totalreserve_pages(void)
                for (i = 0; i < MAX_NR_ZONES; i++) {
                        struct zone *zone = pgdat->node_zones + i;
                        long max = 0;
+                       unsigned long managed_pages = zone->managed_pages;
 
                        /* Find valid and maximum lowmem_reserve in the zone */
                        for (j = i; j < MAX_NR_ZONES; j++) {
@@ -7267,8 +7268,8 @@ static void calculate_totalreserve_pages(void)
                        /* we treat the high watermark as reserved pages. */
                        max += high_wmark_pages(zone);
 
-                       if (max > zone->managed_pages)
-                               max = zone->managed_pages;
+                       if (max > managed_pages)
+                               max = managed_pages;
 
                        pgdat->totalreserve_pages += max;