[Devel] [PATCH rh7 2/2] mm/memcg: Fix potential softlockup during memcgroup shutdown.

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Oct 30 16:51:24 MSK 2017


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 <aryabinin at 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



More information about the Devel mailing list