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

Vasily Averin vvs at virtuozzo.com
Fri Nov 20 21:32:58 MSK 2020


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

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


More information about the Devel mailing list