[Devel] [PATCH RHEL7 COMMIT] memcg: improvements for "memcg leak due to missing css_put on last kmem uncharge"
Vasily Averin
vvs at virtuozzo.com
Thu Feb 25 09:16:07 MSK 2021
The commit is pushed to "branch-rh7-3.10.0-1160.11.1.vz7.172.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.11.1.vz7.172.16
------>
commit c573bf59596b67538d60ddf5cad8a807e3d11157
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Thu Feb 25 09:16:07 2021 +0300
memcg: improvements for "memcg leak due to missing css_put on last kmem uncharge"
- inlined memcg_kmem_release_css() to improve function reference in css_stack
- removed css_get/css_put extra calls in refill_stock/drain_stock
https://bugs.openvz.org/browse/OVZ-7250
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
mm/memcontrol.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3c2538d..ca426134 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -439,7 +439,7 @@ enum {
KMEM_ACCOUNTED_DEAD, /* dead memcg with pending kmem charges */
};
-static void memcg_kmem_release_css(struct mem_cgroup *memcg);
+static inline void memcg_kmem_release_css(struct mem_cgroup *memcg);
static struct mem_cgroup_per_node *
mem_cgroup_nodeinfo(struct mem_cgroup *memcg, int nid)
@@ -2948,7 +2948,6 @@ static void drain_stock(struct memcg_stock_pcp *stock)
stock->kmem_nr_pages = 0;
stock->cache_nr_pages = 0;
}
- css_put(&old->css);
if (kmem == 0)
memcg_kmem_release_css(old);
stock->cached = NULL;
@@ -2987,7 +2986,6 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages,
if (stock->cached != memcg) { /* reset if necessary */
drain_stock(stock);
- css_get(&memcg->css);
stock->cached = memcg;
}
@@ -3622,7 +3620,7 @@ void memcg_uncharge_kmem(struct mem_cgroup *memcg,
memcg_kmem_release_css(memcg);
}
-static void memcg_kmem_release_css(struct mem_cgroup *memcg)
+static inline void memcg_kmem_release_css(struct mem_cgroup *memcg)
{
/*
* Releases a reference taken in memcg_deactivate_kmem in case
More information about the Devel
mailing list