|
@@ -176,6 +176,30 @@ void kmem_cache_free(struct kmem_cache *, void *);
|
|
|
#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
|
|
|
#endif
|
|
|
|
|
|
+/*
|
|
|
+ * This is the main placeholder for memcg-related information in kmem caches.
|
|
|
+ * struct kmem_cache will hold a pointer to it, so the memory cost while
|
|
|
+ * disabled is 1 pointer. The runtime cost while enabled, gets bigger than it
|
|
|
+ * would otherwise be if that would be bundled in kmem_cache: we'll need an
|
|
|
+ * extra pointer chase. But the trade off clearly lays in favor of not
|
|
|
+ * penalizing non-users.
|
|
|
+ *
|
|
|
+ * Both the root cache and the child caches will have it. For the root cache,
|
|
|
+ * this will hold a dynamically allocated array large enough to hold
|
|
|
+ * information about the currently limited memcgs in the system.
|
|
|
+ *
|
|
|
+ * Child caches will hold extra metadata needed for its operation. Fields are:
|
|
|
+ *
|
|
|
+ * @memcg: pointer to the memcg this cache belongs to
|
|
|
+ */
|
|
|
+struct memcg_cache_params {
|
|
|
+ bool is_root_cache;
|
|
|
+ union {
|
|
|
+ struct kmem_cache *memcg_caches[0];
|
|
|
+ struct mem_cgroup *memcg;
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
/*
|
|
|
* Common kmalloc functions provided by all allocators
|
|
|
*/
|