Commit 45973d74 authored by Minchan Kim's avatar Minchan Kim Committed by Linus Torvalds

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().

[akpm@linux-foundation.org: fix comment, layout]
Signed-off-by: default avatarMinchan Kim <minchan.kim@gmail.com>
Reviewed-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Rik van Riel <riel@redhat.com>
Reviewed-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 59e99e5b
...@@ -2060,9 +2060,6 @@ loop_again: ...@@ -2060,9 +2060,6 @@ loop_again:
priority != DEF_PRIORITY) priority != DEF_PRIORITY)
continue; continue;
if (!zone_watermark_ok(zone, order,
high_wmark_pages(zone), end_zone, 0))
all_zones_ok = 0;
temp_priority[i] = priority; temp_priority[i] = priority;
sc.nr_scanned = 0; sc.nr_scanned = 0;
note_zone_scanning_priority(zone, priority); note_zone_scanning_priority(zone, priority);
...@@ -2102,13 +2099,18 @@ loop_again: ...@@ -2102,13 +2099,18 @@ loop_again:
total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2) total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
sc.may_writepage = 1; sc.may_writepage = 1;
/* if (!zone_watermark_ok(zone, order,
* We are still under min water mark. it mean we have high_wmark_pages(zone), end_zone, 0)) {
* GFP_ATOMIC allocation failure risk. Hurry up! all_zones_ok = 0;
*/ /*
if (!zone_watermark_ok(zone, order, min_wmark_pages(zone), * We are still under min water mark. This
end_zone, 0)) * means that we have a GFP_ATOMIC allocation
has_under_min_watermark_zone = 1; * 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) if (all_zones_ok)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment