diff options
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 | |||
159 | static 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 |
159 | static inline bool is_root_cache(struct kmem_cache *s) | 166 | static 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 | |||
201 | static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) | ||
202 | { | ||
203 | return s; | ||
204 | } | ||
193 | #endif | 205 | #endif |
194 | 206 | ||
195 | static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) | 207 | static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x) |