aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-02-22 19:33:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 20:50:14 -0500
commitb40da04946aa7b603b2aa4dd479f83b2c9090d96 (patch)
treee4c93fd9375f9c90449ef37f4456fbd3c5a7b6b6 /mm/vmscan.c
parentf7210e6c4ac795694106c1c5307134d3fc233e88 (diff)
mm: use zone->present_pages instead of zone->managed_pages where appropriate
Now we have zone->managed_pages for "pages managed by the buddy system in the zone", so replace zone->present_pages with zone->managed_pages if what the user really wants is number of allocatable pages. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Cc: Wen Congyang <wency@cn.fujitsu.com> Cc: David Rientjes <rientjes@google.com> Cc: Jiang Liu <jiang.liu@huawei.com> Cc: Maciej Rutecki <maciej.rutecki@gmail.com> Cc: Chris Clayton <chris2553@googlemail.com> Cc: "Rafael J . Wysocki" <rjw@sisk.pl> Cc: Mel Gorman <mgorman@suse.de> Cc: Minchan Kim <minchan@kernel.org> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Jianguo Wu <wujianguo@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4093b99044f6..8fde2fc223d9 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2010,7 +2010,7 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
2010 * a reasonable chance of completing and allocating the page 2010 * a reasonable chance of completing and allocating the page
2011 */ 2011 */
2012 balance_gap = min(low_wmark_pages(zone), 2012 balance_gap = min(low_wmark_pages(zone),
2013 (zone->present_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) / 2013 (zone->managed_pages + KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
2014 KSWAPD_ZONE_BALANCE_GAP_RATIO); 2014 KSWAPD_ZONE_BALANCE_GAP_RATIO);
2015 watermark = high_wmark_pages(zone) + balance_gap + (2UL << sc->order); 2015 watermark = high_wmark_pages(zone) + balance_gap + (2UL << sc->order);
2016 watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, 0, 0); 2016 watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, 0, 0);
@@ -2525,7 +2525,7 @@ static bool zone_balanced(struct zone *zone, int order,
2525 */ 2525 */
2526static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx) 2526static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)
2527{ 2527{
2528 unsigned long present_pages = 0; 2528 unsigned long managed_pages = 0;
2529 unsigned long balanced_pages = 0; 2529 unsigned long balanced_pages = 0;
2530 int i; 2530 int i;
2531 2531
@@ -2536,7 +2536,7 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)
2536 if (!populated_zone(zone)) 2536 if (!populated_zone(zone))
2537 continue; 2537 continue;
2538 2538
2539 present_pages += zone->present_pages; 2539 managed_pages += zone->managed_pages;
2540 2540
2541 /* 2541 /*
2542 * A special case here: 2542 * A special case here:
@@ -2546,18 +2546,18 @@ static bool pgdat_balanced(pg_data_t *pgdat, int order, int classzone_idx)
2546 * they must be considered balanced here as well! 2546 * they must be considered balanced here as well!
2547 */ 2547 */
2548 if (zone->all_unreclaimable) { 2548 if (zone->all_unreclaimable) {
2549 balanced_pages += zone->present_pages; 2549 balanced_pages += zone->managed_pages;
2550 continue; 2550 continue;
2551 } 2551 }
2552 2552
2553 if (zone_balanced(zone, order, 0, i)) 2553 if (zone_balanced(zone, order, 0, i))
2554 balanced_pages += zone->present_pages; 2554 balanced_pages += zone->managed_pages;
2555 else if (!order) 2555 else if (!order)
2556 return false; 2556 return false;
2557 } 2557 }
2558 2558
2559 if (order) 2559 if (order)
2560 return balanced_pages >= (present_pages >> 2); 2560 return balanced_pages >= (managed_pages >> 2);
2561 else 2561 else
2562 return true; 2562 return true;
2563} 2563}
@@ -2745,7 +2745,7 @@ loop_again:
2745 * of the zone, whichever is smaller. 2745 * of the zone, whichever is smaller.
2746 */ 2746 */
2747 balance_gap = min(low_wmark_pages(zone), 2747 balance_gap = min(low_wmark_pages(zone),
2748 (zone->present_pages + 2748 (zone->managed_pages +
2749 KSWAPD_ZONE_BALANCE_GAP_RATIO-1) / 2749 KSWAPD_ZONE_BALANCE_GAP_RATIO-1) /
2750 KSWAPD_ZONE_BALANCE_GAP_RATIO); 2750 KSWAPD_ZONE_BALANCE_GAP_RATIO);
2751 /* 2751 /*