[Devel] [PATCH RHEL7 COMMIT] mm/memcg: Release memcg id from css_free callback

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 14 16:06:26 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.1.vz7.95.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.1.vz7.95.5
------>
commit 5aa078d676719501c88473fe4b9aeeab47882d66
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Tue May 14 15:37:38 2019 +0300

    mm/memcg: Release memcg id from css_free callback
    
    This affectively reverts 9d784f49c1c5 ("Revert: [rh/mm]: delay memcg id
    freeing")
    
    After rebase to kernel-3.10.0-957.10.1.el7 memcg id freed
    in memcg offline callback instead of free. This makes possible
    to reuse id by another cgroup, thus mem_cgroup_uncharge_swap()
    may call css_put() on the wrong cgroup.
    
    Delay release of memcg id up to css_free() point.
    
    https://jira.sw.ru/browse/PSBM-94269
    
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Acked-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/memcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5a0641a38835..4be20b81fcf8 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6345,6 +6345,8 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg)
 
 	mem_cgroup_remove_from_trees(memcg);
 
+	mem_cgroup_id_put(memcg);
+
 	for_each_node(node)
 		free_mem_cgroup_per_zone_info(memcg, node);
 
@@ -6573,8 +6575,6 @@ static void mem_cgroup_css_offline(struct cgroup *cont)
 	 * no longer iterate over it.
 	 */
 	release_oom_context(&memcg->oom_ctx);
-
-	mem_cgroup_id_put(memcg);
 }
 
 static void mem_cgroup_css_free(struct cgroup *cont)



More information about the Devel mailing list