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

Submitted by Andrey Ryabinin on Oct. 30, 2017, 1:51 p.m.

Details

Message ID 20171030135124.19189-2-aryabinin@virtuozzo.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrey Ryabinin Oct. 30, 2017, 1:51 p.m.
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@virtuozzo.com>
---
 mm/memcontrol.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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));
 }