diff options
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -163,6 +163,18 @@ ssize_t slabinfo_write(struct file *file, const char __user *buffer, | |||
163 | size_t count, loff_t *ppos); | 163 | size_t count, loff_t *ppos); |
164 | 164 | ||
165 | #ifdef CONFIG_MEMCG_KMEM | 165 | #ifdef CONFIG_MEMCG_KMEM |
166 | /* | ||
167 | * Iterate over all memcg caches of the given root cache. The caller must hold | ||
168 | * slab_mutex. | ||
169 | */ | ||
170 | #define for_each_memcg_cache(iter, root) \ | ||
171 | list_for_each_entry(iter, &(root)->memcg_params.list, \ | ||
172 | memcg_params.list) | ||
173 | |||
174 | #define for_each_memcg_cache_safe(iter, tmp, root) \ | ||
175 | list_for_each_entry_safe(iter, tmp, &(root)->memcg_params.list, \ | ||
176 | memcg_params.list) | ||
177 | |||
166 | static inline bool is_root_cache(struct kmem_cache *s) | 178 | static inline bool is_root_cache(struct kmem_cache *s) |
167 | { | 179 | { |
168 | return s->memcg_params.is_root_cache; | 180 | return s->memcg_params.is_root_cache; |
@@ -241,6 +253,11 @@ extern void slab_init_memcg_params(struct kmem_cache *); | |||
241 | 253 | ||
242 | #else /* !CONFIG_MEMCG_KMEM */ | 254 | #else /* !CONFIG_MEMCG_KMEM */ |
243 | 255 | ||
256 | #define for_each_memcg_cache(iter, root) \ | ||
257 | for ((void)(iter), (void)(root); 0; ) | ||
258 | #define for_each_memcg_cache_safe(iter, tmp, root) \ | ||
259 | for ((void)(iter), (void)(tmp), (void)(root); 0; ) | ||
260 | |||
244 | static inline bool is_root_cache(struct kmem_cache *s) | 261 | static inline bool is_root_cache(struct kmem_cache *s) |
245 | { | 262 | { |
246 | return true; | 263 | return true; |