diff options
Diffstat (limited to 'include/linux/slab.h')
-rw-r--r-- | include/linux/slab.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/slab.h b/include/linux/slab.h index 743a10415122..00efba149222 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -177,6 +177,30 @@ void kmem_cache_free(struct kmem_cache *, void *); | |||
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | /* | 179 | /* |
180 | * This is the main placeholder for memcg-related information in kmem caches. | ||
181 | * struct kmem_cache will hold a pointer to it, so the memory cost while | ||
182 | * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it | ||
183 | * would otherwise be if that would be bundled in kmem_cache: we'll need an | ||
184 | * extra pointer chase. But the trade off clearly lays in favor of not | ||
185 | * penalizing non-users. | ||
186 | * | ||
187 | * Both the root cache and the child caches will have it. For the root cache, | ||
188 | * this will hold a dynamically allocated array large enough to hold | ||
189 | * information about the currently limited memcgs in the system. | ||
190 | * | ||
191 | * Child caches will hold extra metadata needed for its operation. Fields are: | ||
192 | * | ||
193 | * @memcg: pointer to the memcg this cache belongs to | ||
194 | */ | ||
195 | struct memcg_cache_params { | ||
196 | bool is_root_cache; | ||
197 | union { | ||
198 | struct kmem_cache *memcg_caches[0]; | ||
199 | struct mem_cgroup *memcg; | ||
200 | }; | ||
201 | }; | ||
202 | |||
203 | /* | ||
180 | * Common kmalloc functions provided by all allocators | 204 | * Common kmalloc functions provided by all allocators |
181 | */ | 205 | */ |
182 | void * __must_check __krealloc(const void *, size_t, gfp_t); | 206 | void * __must_check __krealloc(const void *, size_t, gfp_t); |