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, 11 insertions, 1 deletions
diff --git a/mm/slab.h b/mm/slab.h
index 0859c4241ba1..72d1f9df71bd 100644
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -163,9 +163,19 @@ static inline const char *cache_name(struct kmem_cache *s)
163static inline struct kmem_cache * 163static inline struct kmem_cache *
164cache_from_memcg_idx(struct kmem_cache *s, int idx) 164cache_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
171static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) 181static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s)