vmscan: check high watermark after shrink zone

Kswapd checks that zone has sufficient pages free via zone_watermark_ok().

If any zone doesn't have enough pages, we set all_zones_ok to zero.
!all_zone_ok makes kswapd retry rather than sleeping.

I think the watermark check before shrink_zone() is pointless.  Only after
kswapd has tried to shrink the zone is the check meaningful.

Move the check to after the call to shrink_zone().

[[email protected]: fix comment, layout]
Signed-off-by: Minchan Kim <[email protected]>
Reviewed-by: KOSAKI Motohiro <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Rik van Riel <[email protected]>
Reviewed-by: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Minchan Kim 2010-03-05 13:41:45 -08:00 • committed by Linus Torvalds
commit 45973d74fd

View file

@ -2060,9 +2060,6 @@ loop_again:
priority != DEF_PRIORITY)
continue;
if (!zone_watermark_ok(zone, order,
high_wmark_pages(zone), end_zone, 0))
all_zones_ok = 0;
temp_priority[i] = priority;
sc.nr_scanned = 0;
note_zone_scanning_priority(zone, priority);
@ -2102,13 +2099,18 @@ loop_again:
total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
sc.may_writepage = 1;
/*
* We are still under min water mark. it mean we have
* GFP_ATOMIC allocation failure risk. Hurry up!
*/
if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
end_zone, 0))
has_under_min_watermark_zone = 1;
if (!zone_watermark_ok(zone, order,
high_wmark_pages(zone), end_zone, 0)) {
all_zones_ok = 0;
/*
* We are still under min water mark. This
* means that we have a GFP_ATOMIC allocation
* failure risk. Hurry up!
*/
if (!zone_watermark_ok(zone, order,
min_wmark_pages(zone), end_zone, 0))
has_under_min_watermark_zone = 1;
}
}
if (all_zones_ok)