mm: memcontrol: move kmem accounting code to CONFIG_MEMCG
The cgroup2 memory controller will account important in-kernel memory consumers per default. Move all necessary components to CONFIG_MEMCG. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
3893e302f6
commit
127424c86b
@@ -40,7 +40,7 @@ struct list_lru_node {
|
||||
spinlock_t lock;
|
||||
/* global list, used for the root cgroup in cgroup aware lrus */
|
||||
struct list_lru_one lru;
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
|
||||
/* for cgroup aware lrus points to per cgroup lists, otherwise NULL */
|
||||
struct list_lru_memcg *memcg_lrus;
|
||||
#endif
|
||||
@@ -48,7 +48,7 @@ struct list_lru_node {
|
||||
|
||||
struct list_lru {
|
||||
struct list_lru_node *node;
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
|
||||
struct list_head list;
|
||||
#endif
|
||||
};
|
||||
|
@@ -236,7 +236,7 @@ struct mem_cgroup {
|
||||
#if defined(CONFIG_MEMCG_KMEM) && defined(CONFIG_INET)
|
||||
struct cg_proto tcp_mem;
|
||||
#endif
|
||||
#if defined(CONFIG_MEMCG_KMEM)
|
||||
#ifndef CONFIG_SLOB
|
||||
/* Index in the kmem_cache->memcg_params.memcg_caches array */
|
||||
int kmemcg_id;
|
||||
enum memcg_kmem_state kmem_state;
|
||||
@@ -735,7 +735,7 @@ static inline bool mem_cgroup_under_socket_pressure(struct mem_cgroup *memcg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
|
||||
extern struct static_key_false memcg_kmem_enabled_key;
|
||||
|
||||
extern int memcg_nr_cache_ids;
|
||||
@@ -891,5 +891,6 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
|
||||
static inline void memcg_kmem_put_cache(struct kmem_cache *cachep)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_MEMCG_KMEM */
|
||||
#endif /* CONFIG_MEMCG && !CONFIG_SLOB */
|
||||
|
||||
#endif /* _LINUX_MEMCONTROL_H */
|
||||
|
@@ -1476,10 +1476,10 @@ struct task_struct {
|
||||
unsigned in_iowait:1;
|
||||
#ifdef CONFIG_MEMCG
|
||||
unsigned memcg_may_oom:1;
|
||||
#endif
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifndef CONFIG_SLOB
|
||||
unsigned memcg_kmem_skip_account:1;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef CONFIG_COMPAT_BRK
|
||||
unsigned brk_randomized:1;
|
||||
#endif
|
||||
|
@@ -86,7 +86,7 @@
|
||||
#else
|
||||
# define SLAB_FAILSLAB 0x00000000UL
|
||||
#endif
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB)
|
||||
# define SLAB_ACCOUNT 0x04000000UL /* Account to memcg */
|
||||
#else
|
||||
# define SLAB_ACCOUNT 0x00000000UL
|
||||
|
@@ -69,7 +69,8 @@ struct kmem_cache {
|
||||
*/
|
||||
int obj_offset;
|
||||
#endif /* CONFIG_DEBUG_SLAB */
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
|
||||
#ifdef CONFIG_MEMCG
|
||||
struct memcg_cache_params memcg_params;
|
||||
#endif
|
||||
|
||||
|
@@ -84,7 +84,7 @@ struct kmem_cache {
|
||||
#ifdef CONFIG_SYSFS
|
||||
struct kobject kobj; /* For sysfs */
|
||||
#endif
|
||||
#ifdef CONFIG_MEMCG_KMEM
|
||||
#ifdef CONFIG_MEMCG
|
||||
struct memcg_cache_params memcg_params;
|
||||
int max_attr_size; /* for propagation, maximum size of a stored attr */
|
||||
#ifdef CONFIG_SYSFS
|
||||
|
Reference in New Issue
Block a user