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

Andrey Ryabinin aryabinin at virtuozzo.com
Tue May 14 14:20:13 MSK 2019


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 at virtuozzo.com>
---
 mm/memcontrol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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



More information about the Devel mailing list