]> git.karo-electronics.de Git - karo-tx-linux.git/commit
memcg: add comments clarifying aspects of cache attribute propagation
authorGlauber Costa <glommer@parallels.com>
Thu, 29 Nov 2012 03:17:09 +0000 (14:17 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2012 05:23:01 +0000 (16:23 +1100)
commit6899469f7196803209036ffb813c74af869fd6be
treeba0f1d559f979e3086b73ab97bb56e95c1155449
parenteb8cde1d21bcbc8e0e547941b85ab9ec3e24a981
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>
include/linux/memcontrol.h
mm/slab.c
mm/slub.c