On a huge mem cgroup mem_cgroup_force_empty_list() may iterate
for a long time without rescheduling and cause softlockup.
Add cond_resched() to avoid this.

https://jira.sw.ru/browse/PSBM-76011
Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 mm/memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index efc455d8ca81..a7fa84a9980a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4038,8 +4038,10 @@ static void mem_cgroup_force_empty_list(struct 
mem_cgroup *memcg,
                        /* found lock contention or "pc" is obsolete. */
                        busy = page;
                        schedule_timeout_uninterruptible(1);
-               } else
+               } else {
                        busy = NULL;
+                       cond_resched();
+               }
        } while (!list_empty(list));
 }
 
-- 
2.13.6

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to