memcg: do not account memory used for cache creation
authorGlauber Costa <[email protected]>
Mon, 8 Jul 2013 23:00:01 +0000 (16:00 -0700)
committerLinus Torvalds <[email protected]>
Tue, 9 Jul 2013 17:33:21 +0000 (10:33 -0700)
The memory we used to hold the memcg arrays is currently accounted to
the current memcg.  But that creates a problem, because that memory can
only be freed after the last user is gone.  Our only way to know which
is the last user, is to hook up to freeing time, but the fact that we
still have some in flight kmallocs will prevent freeing to happen.  I
believe therefore to be just easier to account this memory as global
overhead.

Signed-off-by: Glauber Costa <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Kamezawa Hiroyuki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memcontrol.c

index 06a595fd6400496b6ebe39e537f188bd84ecbccb..64f726599ff06c6319b82c05dc5a93ef17f5fe09 100644 (file)
@@ -5232,7 +5232,9 @@ static int memcg_propagate_kmem(struct mem_cgroup *memcg)
        static_key_slow_inc(&memcg_kmem_enabled_key);
 
        mutex_lock(&set_limit_mutex);
+       memcg_stop_kmem_account();
        ret = memcg_update_cache_sizes(memcg);
+       memcg_resume_kmem_account();
        mutex_unlock(&set_limit_mutex);
 out:
        return ret;