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

Submitted by Andrey Ryabinin on Feb. 19, 2019, 8:29 a.m.

Details

Message ID 20190219082926.13311-7-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Feb. 19, 2019, 8:29 a.m.
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@virtuozzo.com>
---
 mm/vmscan.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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