[Devel] [PATCH RHEL7 COMMIT] mm/vmscan: Don't shrink active lrus on the first try.

Konstantin Khorenko khorenko at virtuozzo.com
Wed Feb 20 16:32:24 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.1.3.vz7.83.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.1.3.vz7.83.13
------>
commit ef120a1ee4af49d4db22d8f8cf671275670a6f8a
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Wed Feb 20 16:32:22 2019 +0300

    mm/vmscan: Don't shrink active lrus on the first try.
    
    Currently we scan all cgroups and shrink active list when
    inactive list is too 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>
    
    khorenko@: the patch is intended to handle following situation:
    - cgroup A: unlimited, some fat applications are run inside =>
      exec filecache + anon (both - mostly active), but almost no
      non-exec pagecache
    - neighbour cgroup B: unlimited, generates a lot of pagecache
      (for example runs dd)
    - cgroup C, parent for A and B: limited either by memsw or by pagecache
      (vz specific)
    
    On unpatched kernel the configuration above leads to the situation when
    pagecache generated by cgroup B pressures and trashes active exec filecache
    from cgroup A.
---
 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



More information about the Devel mailing list