diff options
Diffstat (limited to 'mm/slab.h')
-rw-r--r-- | mm/slab.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -117,6 +117,21 @@ static inline bool cache_match_memcg(struct kmem_cache *cachep, | |||
117 | (cachep->memcg_params->memcg == memcg); | 117 | (cachep->memcg_params->memcg == memcg); |
118 | } | 118 | } |
119 | 119 | ||
120 | static inline void memcg_bind_pages(struct kmem_cache *s, int order) | ||
121 | { | ||
122 | if (!is_root_cache(s)) | ||
123 | atomic_add(1 << order, &s->memcg_params->nr_pages); | ||
124 | } | ||
125 | |||
126 | static inline void memcg_release_pages(struct kmem_cache *s, int order) | ||
127 | { | ||
128 | if (is_root_cache(s)) | ||
129 | return; | ||
130 | |||
131 | if (atomic_sub_and_test((1 << order), &s->memcg_params->nr_pages)) | ||
132 | mem_cgroup_destroy_cache(s); | ||
133 | } | ||
134 | |||
120 | static inline bool slab_equal_or_root(struct kmem_cache *s, | 135 | static inline bool slab_equal_or_root(struct kmem_cache *s, |
121 | struct kmem_cache *p) | 136 | struct kmem_cache *p) |
122 | { | 137 | { |
@@ -135,6 +150,14 @@ static inline bool cache_match_memcg(struct kmem_cache *cachep, | |||
135 | return true; | 150 | return true; |
136 | } | 151 | } |
137 | 152 | ||
153 | static inline void memcg_bind_pages(struct kmem_cache *s, int order) | ||
154 | { | ||
155 | } | ||
156 | |||
157 | static inline void memcg_release_pages(struct kmem_cache *s, int order) | ||
158 | { | ||
159 | } | ||
160 | |||
138 | static inline bool slab_equal_or_root(struct kmem_cache *s, | 161 | static inline bool slab_equal_or_root(struct kmem_cache *s, |
139 | struct kmem_cache *p) | 162 | struct kmem_cache *p) |
140 | { | 163 | { |