Hi, In my last submission for the kmem controller for memcg, Kame noted that the way we use to guarantee that the memcg will still be around while there are charges is quite expensive: we issue mem_cgroup_get() in every charge, that is countered by mem_cgroup_put() in every uncharge. I am trying an alternate way through the two patches that follow. The idea is to only call mem_cgroup_get() when the first charge happens. We'll use a bit in the kmem_accounted bitmap for that: we have plenty. We allow the allocations to continue paying only the cost of a likely branch over a simple test after that. We also note through another bit the destruction of that group. When charges get down to 0 after destruction, we then proceed to release the reference. I am sending those two patches separately so they get reviewed on their own. If nobody opposes, I'll add them ontop of the current kmem patches. Thanks. Glauber Costa (2): return amount of charges after res_counter_uncharge Avoid doing a get/put pair in every kmemcg charge Documentation/cgroups/resource_counter.txt | 7 ++-- include/linux/res_counter.h | 12 ++++--- kernel/res_counter.c | 20 +++++++---- mm/memcontrol.c | 57 ++++++++++++++++++++++++++---- 4 files changed, 74 insertions(+), 22 deletions(-) -- 1.7.11.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>