[Devel] [PATCH RHEL8 COMMIT] mm/vmscan: add cond_resched() to loop in shrink_slab_memcg()
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 18 14:33:08 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.45
------>
commit c1db2f24855898a26e081ddb314a9c3bac26ddf6
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Fri Jun 18 14:33:08 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>
(cherry picked from vz7 commit c2ccf83304f1 ("mm/vmscan: add cond_resched() to
loop in shrink_slab_memcg()"))
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 24ee7b11070e..bc1f1025c99d 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)
More information about the Devel
mailing list