[Xenial][SRU][PATCH] UBUNTU: SAUCE(no-up): If zone is so small that watermarks are the same, stop zone balance.

Gavin Guo gavin.guo at canonical.com
Wed Oct 12 01:13:35 UTC 2016


BugLink: http://bugs.launchpad.net/bugs/1518457

On an AWS t2.micro instance (Xeon E5-2670, 991MiB of memory).
Occasionally (about once a day), kswapd0 falls into a busy loop and
spins on 100% CPU usage indefinitely. Reject to do the zone balance
when the memory is too small.

Signed-off-by: Dan Streetman <dan.streetman at canonical.com>
Signed-off-by: Gavin Guo <gavin.guo at canonical.com>
---
 mm/vmscan.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0c114e2b01d3..21755dca16c2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2959,6 +2959,13 @@ static void age_active_anon(struct zone *zone, struct scan_control *sc)
 static bool zone_balanced(struct zone *zone, int order,
 			  unsigned long balance_gap, int classzone_idx)
 {
+	/*
+	 * if zone is so small that watermarks are the same, don't bother trying
+	 * to balance; kswapd would just spin continuously trying to balance it.
+	 */
+	if (low_wmark_pages(zone) == high_wmark_pages(zone))
+		return true;
+
 	if (!zone_watermark_ok_safe(zone, order, high_wmark_pages(zone) +
 				    balance_gap, classzone_idx))
 		return false;
-- 
2.7.4





More information about the kernel-team mailing list