aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.h
diff options
context:
space:
mode:
Diffstat (limited to 'mm/slab.h')
-rw-r--r--mm/slab.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/mm/slab.h b/mm/slab.h
index ec5dae1c8e75..34a98d642196 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -155,6 +155,13 @@ static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)
155{ 155{
156 return s->memcg_params->memcg_caches[idx]; 156 return s->memcg_params->memcg_caches[idx];
157} 157}
158
159static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s)
160{
161 if (is_root_cache(s))
162 return s;
163 return s->memcg_params->root_cache;
164}
158#else 165#else
159static inline bool is_root_cache(struct kmem_cache *s) 166static inline bool is_root_cache(struct kmem_cache *s)
160{ 167{
@@ -190,6 +197,11 @@ static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx)
190{ 197{
191 return NULL; 198 return NULL;
192} 199}
200
201static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s)
202{
203 return s;
204}
193#endif 205#endif
194 206
195static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) 207static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)