diff options
author | Glauber Costa <glommer@parallels.com> | 2012-12-18 14:23:10 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 15:02:15 -0800 |
commit | ebe945c27628fca03723582eba138acc2e2f3d15 (patch) | |
tree | 5998e8dd874aedf3b8873d0ffeaf658d10505655 /mm/slab.c | |
parent | 92e793495597af4135d94314113bf13eafb0e663 (diff) | |
download | blackbird-op-linux-ebe945c27628fca03723582eba138acc2e2f3d15.tar.gz blackbird-op-linux-ebe945c27628fca03723582eba138acc2e2f3d15.zip |
memcg: add comments clarifying aspects of cache attribute propagation
This patch clarifies two aspects of cache attribute propagation.
First, the expected context for the for_each_memcg_cache macro in
memcontrol.h. The usages already in the codebase are safe. In mm/slub.c,
it is trivially safe because the lock is acquired right before the loop.
In mm/slab.c, it is less so: the lock is acquired by an outer function a
few steps back in the stack, so a VM_BUG_ON() is added to make sure it is
indeed safe.
A comment is also added to detail why we are returning the value of the
parent cache and ignoring the children's when we propagate the attributes.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/slab.c b/mm/slab.c index 4dcbf96a77b4..e7667a3584bc 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4099,6 +4099,7 @@ static int do_tune_cpucache(struct kmem_cache *cachep, int limit, if ((ret < 0) || !is_root_cache(cachep)) return ret; + VM_BUG_ON(!mutex_is_locked(&slab_mutex)); for_each_memcg_cache_index(i) { c = cache_from_memcg(cachep, i); if (c) |