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

Konstantin Khorenko khorenko at virtuozzo.com
Sat Mar 30 10:57:10 MSK 2019


From: Andrey Ryabinin <aryabinin at virtuozzo.com>

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;
-- 
2.15.1



More information about the Devel mailing list