mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
92e7934955
commit
ebe945c276
3 changed files with 24 additions and 4 deletions
|
@ -422,6 +422,12 @@ static inline void sock_release_memcg(struct sock *sk)
|
|||
extern struct static_key memcg_kmem_enabled_key;
|
||||
|
||||
extern int memcg_limited_groups_array_size;
|
||||
|
||||
/*
|
||||
* Helper macro to loop through all memcg-specific caches. Callers must still
|
||||
* check if the cache is valid (it is either valid or NULL).
|
||||
* the slab_mutex must be held when looping through those caches
|
||||
*/
|
||||
#define for_each_memcg_cache_index(_idx) \
|
||||
for ((_idx) = 0; i < memcg_limited_groups_array_size; (_idx)++)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue