[RHEL7,v2] mm/memcg: Release memcg id from css_free callback

Submitted by Konstantin Khorenko on May 14, 2019, 12:41 p.m.


Message ID 20190514124154.23633-1-khorenko@virtuozzo.com
State New
Series "mm/memcg: Release memcg id from css_free callback"
Headers show

Commit Message

Konstantin Khorenko May 14, 2019, 12:41 p.m.
From: Andrey Ryabinin <aryabinin@virtuozzo.com>

This affectively reverts 9d784f49c1c5 ("Revert: [rh/mm]: delay memcg id

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.


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

Patch hide | download patch | download mbox

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_id_put(memcg);
 		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.
-	mem_cgroup_id_put(memcg);
 static void mem_cgroup_css_free(struct cgroup *cont)