[Devel] [PATCH rh7 v2 7/7] mm/vmscan: Don't shrink active lrus on the first try.

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Feb 19 11:29:26 MSK 2019


Currently we scan all cgroups and shrink active list when
inactive list is to low. It might be better to reclaim
only inactive pages from cgroups that have big enough
inactive lru and fallback to active only if all inactive
lrus are too small.

https://pmc.acronis.com/browse/VSTOR-19037
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/vmscan.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index f64c8775ac9e..2ba4a11a67f7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2043,12 +2043,15 @@ static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
 				 struct scan_control *sc)
 {
 	if (is_active_lru(lru)) {
-		if (inactive_list_is_low(lruvec, is_file_lru(lru), memcg, true))
+		if (sc->may_thrash && inactive_list_is_low(lruvec,
+					is_file_lru(lru), memcg, true))
 			shrink_active_list(nr_to_scan, lruvec, sc, lru);
 		return 0;
 	}
-
-	return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
+	if (sc->may_thrash || !inactive_list_is_low(lruvec, is_file_lru(lru),
+							memcg, false))
+		return shrink_inactive_list(nr_to_scan, lruvec, sc, lru);
+	return 0;
 }
 
 #ifdef CONFIG_MEMCG
-- 
2.19.2



More information about the Devel mailing list