From: Andrey Ryabinin <[email protected]>

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 <[email protected]>
Reviewed-by: Kirill Tkhai <[email protected]>

(cherry picked from commit c2ccf83304f17a1b116497cabce48a22d18a8df4)
Signed-off-by: Andrey Zhadchenko <[email protected]>
---
 mm/vmscan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 24ee7b1..bc1f102 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -561,6 +561,8 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int 
nid,
                };
                struct shrinker *shrinker;
 
+               cond_resched();
+
                shrinker = idr_find(&shrinker_idr, i);
                if (unlikely(!shrinker || shrinker == SHRINKER_REGISTERING)) {
                        if (!shrinker)
-- 
1.8.3.1

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

Reply via email to