[Devel] [PATCH RHEL7 COMMIT] mm/vmscan: add cond_resched() to loop in shrink_slab_memcg()

Vasily Averin vvs at virtuozzo.com
Wed Feb 3 10:40:05 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.11.1.vz7.172.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.11.1.vz7.172.11
------>
commit c2ccf83304f17a1b116497cabce48a22d18a8df4
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Wed Feb 3 10:40:05 2021 +0300

    mm/vmscan: add cond_resched() to loop in shrink_slab_memcg()
    
    shrink_slab_memcg() may iterate for a long time without resched if we
    have many memcg with small amount of objects. Add cond_resched() to
    avoid potential softlockup.
    
    https://jira.sw.ru/browse/PSBM-125095
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 mm/vmscan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index ebb97ad..81a1153 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -527,6 +527,8 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid,
 		struct shrinker *shrinker;
 		bool is_nfs;
 
+		cond_resched();
+
 		shrinker = idr_find(&shrinker_idr, i);
 		if (unlikely(!shrinker)) {
 			clear_bit(i, map->map);


More information about the Devel mailing list