[RHEL7,COMMIT] mm/memcg: cleanup vmpressure from mem_cgroup_css_free()

Submitted by Vasily Averin on Nov. 20, 2020, 6:32 p.m.

Details

Message ID 202011201832.0AKIWwaF001976@vz7build.vvs.sw.ru
State New
Series "mm/memcg: cleanup vmpressure from mem_cgroup_css_free()"
Headers show

Commit Message

Vasily Averin Nov. 20, 2020, 6:32 p.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.45
------>
commit 842d2de61c9f6966ed94f5a6fec25bff6d6f2220
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Fri Nov 20 21:32:57 2020 +0300

    mm/memcg: cleanup vmpressure from mem_cgroup_css_free()
    
    Cleaning up vmpressure from mem_cgroup_css_offline() doesn't look
    safe. It looks like mem_cgroup_css_offline() might race with reclaim
    which will queue vmpressure work  after the flush.
    
    Put vmpressure_cleanup() in mem_cgroup_css_free() where we have
    exclusive access to memcg. It was originally there, see
    https://jira.sw.ru/browse/PSBM-93884 but moved in a process of rebase.
    
    https://jira.sw.ru/browse/PSBM-122653
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e0e113b..e15935f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6831,8 +6831,6 @@  static void mem_cgroup_css_offline(struct cgroup *cont)
 	mem_cgroup_free_all(memcg);
 	mem_cgroup_reparent_charges(memcg);
 
-	vmpressure_cleanup(&memcg->vmpressure);
-
 	/*
 	 * A cgroup can be destroyed while somebody is waiting for its
 	 * oom context, in which case the context will never be unlocked
@@ -6887,7 +6885,7 @@  static void mem_cgroup_css_free(struct cgroup *cont)
 	mem_cgroup_reparent_charges(memcg);
 
 	cancel_work_sync(&memcg->high_work);
-
+	vmpressure_cleanup(&memcg->vmpressure);
 	memcg_destroy_kmem(memcg);
 	memcg_free_shrinker_maps(memcg);
 	__mem_cgroup_free(memcg);