[Devel] [PATCH RHEL7 COMMIT] mm/memcg: add missing kmem charge
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Aug 31 11:52:13 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.35.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.35.5
------>
commit 822bec288dcaf5f69c1ed3e64734230320c798ba
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Thu Aug 31 11:52:13 2017 +0300
mm/memcg: add missing kmem charge
Since de3a106e28d5 ("mm/memcg: reclaim memory on reaching kmem limit.")
if try_charge() decide to bypass memory limit, memcg_charge_kmem()
will charge only ->memory/->memsw but not ->kmem. This may lead to
deadlocks during cgroup destruction as condition:
(page_counter_read(&memcg->memory) -
page_counter_read(&memcg->kmem) > 0)
in mem_cgroup_reparent_charges() won't come true ever.
https://jira.sw.ru/browse/PSBM-70556
Fixes: de3a106e28d5 ("mm/memcg: reclaim memory on reaching kmem limit.")
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
Reviewed-by: Vasily Averin <vvs at virtuozzo.com>
---
mm/memcontrol.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 97824e2..09ce016 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3087,6 +3087,8 @@ int memcg_charge_kmem(struct mem_cgroup *memcg, gfp_t gfp,
page_counter_charge(&memcg->memory, nr_pages);
if (do_swap_account)
page_counter_charge(&memcg->memsw, nr_pages);
+ page_counter_charge(&memcg->kmem, nr_pages);
+
ret = 0;
}
More information about the Devel
mailing list