[rh7] mm/memcg: Don't sleep on reparenting of every page.

Submitted by Andrey Ryabinin on May 14, 2019, 11:20 a.m.

Details

Message ID 20190514112013.2252-1-aryabinin@virtuozzo.com
State New
Series "mm/memcg: Don't sleep on reparenting of every page."
Headers show

Commit Message

Andrey Ryabinin May 14, 2019, 11:20 a.m.
Now we call schedule_timeout_uninterruptible() on reparenting of every
single page. This makes forever for reparanting to complete. Restore
pre-rebase behavior - schedule_timeout_uninterruptible() only on busy
page where it's needed to prevent deadlocks.

Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e6e1b8e8c9c9..b4a046b8d717 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4249,7 +4249,6 @@  static void mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
 		struct page_cgroup *pc;
 		struct page *page;
 
-		schedule_timeout_uninterruptible(1);
 		spin_lock_irqsave(&zone->lru_lock, flags);
 		if (list_empty(list)) {
 			spin_unlock_irqrestore(&zone->lru_lock, flags);
@@ -4269,8 +4268,11 @@  static void mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
 		if (mem_cgroup_move_parent(page, pc, memcg)) {
 			/* found lock contention or "pc" is obsolete. */
 			busy = page;
-		} else
+			schedule_timeout_uninterruptible(1);
+		} else {
 			busy = NULL;
+			cond_resched();
+		}
 	} while (!list_empty(list));
 }