From: Andrey Ryabinin <[email protected]>

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 <[email protected]>
Acked-by: Konstantin Khorenko <[email protected]>
---
 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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to