[Devel] [PATCH RHEL7 COMMIT] ms/vmscan: do not force-scan file lru if its absolute size is small

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 23 06:40:12 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.12
------>
commit 8a0590a689ba4e773503449f5833e2daaf4486c0
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Mon Nov 23 18:40:12 2015 +0400

    ms/vmscan: do not force-scan file lru if its absolute size is small
    
    We assume there is enough inactive page cache if the size of inactive
    file lru is greater than the size of active file lru, in which case we
    force-scan file lru ignoring anonymous pages. While this logic works
    fine when there are plenty of page cache pages, it fails if the size of
    file lru is small (several MB): in this case (lru_size >> prio) will be
    0 for normal scan priorities, as a result, if inactive file lru happens
    to be larger than active file lru, anonymous pages of a cgroup will
    never get evicted unless the system experiences severe memory pressure,
    even if there are gigabytes of unused anonymous memory there, which is
    unfair in respect to other cgroups, whose workloads might be page cache
    oriented.
    
    This patch attempts to fix this by elaborating the "enough inactive page
    cache" check: it makes it not only check that inactive lru size > active
    lru size, but also that we will scan something from the cgroup at the
    current scan priority. If these conditions do not hold, we proceed to
    SCAN_FRACT as usual.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
    
    Acked-by: Johannes Weiner <hannes at cmpxchg.org>
    [ this patch was merged to mmots: http://ozlabs.org/~akpm/mmots/broken-out/vmscan-do-not-force-scan-file-lru-if-its-absolute-size-is-small.patch ]
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 1ab462b..9b1c73b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2056,7 +2056,8 @@ static void get_scan_count(struct lruvec *lruvec, struct scan_control *sc,
 	 * There is enough inactive page cache, do not reclaim
 	 * anything from the anonymous working set right now.
 	 */
-	if (!inactive_file_is_low(lruvec)) {
+	if (!inactive_file_is_low(lruvec) &&
+	    get_lru_size(lruvec, LRU_INACTIVE_FILE) >> sc->priority > 0) {
 		scan_balance = SCAN_FILE;
 		goto out;
 	}


More information about the Devel mailing list