[Devel] [PATCH RH8] mm/vmscan: add cond_resched() to loop in shrink_slab_memcg()
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Wed Jun 16 18:54:30 MSK 2021
From: Andrey Ryabinin <aryabinin at virtuozzo.com>
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>
(cherry picked from commit c2ccf83304f17a1b116497cabce48a22d18a8df4)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
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
More information about the Devel
mailing list