[Devel] [PATCH RHEL7 COMMIT] mm/vmscan: don't shrink active list once more in case we reached nr_to_reclaim

Konstantin Khorenko khorenko at virtuozzo.com
Mon Apr 1 12:26:40 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.85.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.85.7
------>
commit b64ca8bd3434145bb977076f2cc66e1a31da85bd
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Sat Mar 30 10:43:26 2019 +0300

    mm/vmscan: don't shrink active list once more in case we reached nr_to_reclaim
    
    In shrink_zone() we shrink list in cycle and break if nr_to_reclaim is
    reached.
    But after the while cycle we check and may go to the second run in case
    (!sc->has_inactive && !sc->may_shrink_active) without honoring the
    nr_reclaimed up to the moment.
    
    Don't do extra work.
    
    Found while working on
    https://jira.sw.ru/browse/PSBM-92480
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Acked-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/vmscan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index d84ba1a5c4f8..1f5f48dd3cf1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2600,7 +2600,8 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc,
 		} while ((memcg = mem_cgroup_iter(root, memcg, &reclaim)));
 
 		if ((!sc->has_inactive || !sc->nr_reclaimed)
-		    && !sc->may_shrink_active) {
+		    && !sc->may_shrink_active
+		    && (sc->nr_reclaimed < sc->nr_to_reclaim)) {
 			sc->may_shrink_active = 1;
 			retry = true;
 			continue;



More information about the Devel mailing list