[Devel] [PATCH RHEL7 COMMIT] vmscan: don't report reclaim progress if there was no progress.

Vasily Averin vvs at virtuozzo.com
Tue Oct 6 11:19:19 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.33
------>
commit 7a23b037273068bf27c72d8cbdfcb6416c001872
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Oct 6 11:19:19 2020 +0300

    vmscan: don't report reclaim progress if there was no progress.
    
    __alloc_pages_slowpath relies on the direct reclaim and did_some_progress
    as an indicator that it makes sense to retry allocation rather than
    declaring OOM. shrink_zones checks if all zones reclaimable and if
    shrink_zone didn't make any progress it prevents from a premature OOM
    killer invocation by reporting the progress.
    This might happen if the LRU is full of dirty or writeback pages
    and direct reclaim cannot clean those up.
    
    zone_reclaimable allows to rescan the reclaimable lists several times
    and restart if a page is freed.  This is really subtle behavior and it
    might lead to a livelock when a single freed page keeps allocator
    looping but the current task will not be able to allocate that single
    page.  OOM killer would be more appropriate than looping without any
    progress for unbounded amount of time.
    
    Report no progress even if zones are reclaimable as OOM is more appropiate
    in that case.
    
    https://jira.sw.ru/browse/PSBM-104900
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/vmscan.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 13ae9bd..85622f2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2952,26 +2952,6 @@ static void snapshot_refaults(struct mem_cgroup *root_memcg, struct zone *zone)
        } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL)));
 }
 
-/* All zones in zonelist are unreclaimable? */
-static bool all_unreclaimable(struct zonelist *zonelist,
-		struct scan_control *sc)
-{
-	struct zoneref *z;
-	struct zone *zone;
-
-	for_each_zone_zonelist_nodemask(zone, z, zonelist,
-			gfp_zone(sc->gfp_mask), sc->nodemask) {
-		if (!populated_zone(zone))
-			continue;
-		if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL))
-			continue;
-		if (zone_reclaimable(zone))
-			return false;
-	}
-
-	return true;
-}
-
 static void shrink_tcrutches(struct scan_control *scan_ctrl)
 {
 	int nid;
@@ -3097,10 +3077,6 @@ out:
 		goto retry;
 	}
 
-	/* top priority shrink_zones still had more to do? don't OOM, then */
-	if (global_reclaim(sc) && !all_unreclaimable(zonelist, sc))
-		return 1;
-
 	return 0;
 }
 


More information about the Devel mailing list