diff options
author | Glauber Costa <glommer@parallels.com> | 2012-12-18 17:23:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-18 18:02:14 -0500 |
commit | 749c54151a6e5b229e4ae067dbc651e54b161fbc (patch) | |
tree | 8d2d858e76e44d1bbf64439c189a57c18c8e60ae /mm/slab.h | |
parent | 22933152934f30de6f05b600c03f8a08f853a8d2 (diff) |
memcg: aggregate memcg cache values in slabinfo
When we create caches in memcgs, we need to display their usage
information somewhere. We'll adopt a scheme similar to /proc/meminfo,
with aggregate totals shown in the global file, and per-group information
stored in the group itself.
For the time being, only reads are allowed in the per-group cache.
Signed-off-by: Glauber Costa <glommer@parallels.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Frederic Weisbecker <fweisbec@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: JoonSoo Kim <js1304@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -138,6 +138,23 @@ static inline bool slab_equal_or_root(struct kmem_cache *s, | |||
138 | return (p == s) || | 138 | return (p == s) || |
139 | (s->memcg_params && (p == s->memcg_params->root_cache)); | 139 | (s->memcg_params && (p == s->memcg_params->root_cache)); |
140 | } | 140 | } |
141 | |||
142 | /* | ||
143 | * We use suffixes to the name in memcg because we can't have caches | ||
144 | * created in the system with the same name. But when we print them | ||
145 | * locally, better refer to them with the base name | ||
146 | */ | ||
147 | static inline const char *cache_name(struct kmem_cache *s) | ||
148 | { | ||
149 | if (!is_root_cache(s)) | ||
150 | return s->memcg_params->root_cache->name; | ||
151 | return s->name; | ||
152 | } | ||
153 | |||
154 | static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx) | ||
155 | { | ||
156 | return s->memcg_params->memcg_caches[idx]; | ||
157 | } | ||
141 | #else | 158 | #else |
142 | static inline bool is_root_cache(struct kmem_cache *s) | 159 | static inline bool is_root_cache(struct kmem_cache *s) |
143 | { | 160 | { |
@@ -163,6 +180,16 @@ static inline bool slab_equal_or_root(struct kmem_cache *s, | |||
163 | { | 180 | { |
164 | return true; | 181 | return true; |
165 | } | 182 | } |
183 | |||
184 | static inline const char *cache_name(struct kmem_cache *s) | ||
185 | { | ||
186 | return s->name; | ||
187 | } | ||
188 | |||
189 | static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx) | ||
190 | { | ||
191 | return NULL; | ||
192 | } | ||
166 | #endif | 193 | #endif |
167 | 194 | ||
168 | static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) | 195 | static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) |