diff options
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -163,9 +163,19 @@ static inline const char *cache_name(struct kmem_cache *s) | |||
163 | static inline struct kmem_cache * | 163 | static inline struct kmem_cache * |
164 | cache_from_memcg_idx(struct kmem_cache *s, int idx) | 164 | cache_from_memcg_idx(struct kmem_cache *s, int idx) |
165 | { | 165 | { |
166 | struct kmem_cache *cachep; | ||
167 | |||
166 | if (!s->memcg_params) | 168 | if (!s->memcg_params) |
167 | return NULL; | 169 | return NULL; |
168 | return s->memcg_params->memcg_caches[idx]; | 170 | cachep = s->memcg_params->memcg_caches[idx]; |
171 | |||
172 | /* | ||
173 | * Make sure we will access the up-to-date value. The code updating | ||
174 | * memcg_caches issues a write barrier to match this (see | ||
175 | * memcg_register_cache()). | ||
176 | */ | ||
177 | smp_read_barrier_depends(); | ||
178 | return cachep; | ||
169 | } | 179 | } |
170 | 180 | ||
171 | static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) | 181 | static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) |