diff options
author | Vladimir Davydov <vdavydov@virtuozzo.com> | 2016-01-20 18:02:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-20 20:09:18 -0500 |
commit | 04823c833b3eaef7816e28e3727124394f6bb3c3 (patch) | |
tree | 2fd7291cb5605b74a834aa44f91a754ae860238a /mm | |
parent | 52c29b04823cb1bab2805336b80866325fe2bc3f (diff) |
mm: memcontrol: allow to disable kmem accounting for cgroup2
Kmem accounting might incur overhead that some users can't put up with.
Besides, the implementation is still considered unstable. So let's
provide a way to disable it for those users who aren't happy with it.
To disable kmem accounting for cgroup2, pass cgroup.memory=nokmem at
boot time.
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memcontrol.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9e7a4e521917..2239e6dd4d4c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -83,6 +83,9 @@ struct mem_cgroup *root_mem_cgroup __read_mostly; | |||
83 | /* Socket memory accounting disabled? */ | 83 | /* Socket memory accounting disabled? */ |
84 | static bool cgroup_memory_nosocket; | 84 | static bool cgroup_memory_nosocket; |
85 | 85 | ||
86 | /* Kernel memory accounting disabled? */ | ||
87 | static bool cgroup_memory_nokmem; | ||
88 | |||
86 | /* Whether the swap controller is active */ | 89 | /* Whether the swap controller is active */ |
87 | #ifdef CONFIG_MEMCG_SWAP | 90 | #ifdef CONFIG_MEMCG_SWAP |
88 | int do_swap_account __read_mostly; | 91 | int do_swap_account __read_mostly; |
@@ -2925,8 +2928,8 @@ static int memcg_propagate_kmem(struct mem_cgroup *memcg) | |||
2925 | * onlined after this point, because it has at least one child | 2928 | * onlined after this point, because it has at least one child |
2926 | * already. | 2929 | * already. |
2927 | */ | 2930 | */ |
2928 | if (cgroup_subsys_on_dfl(memory_cgrp_subsys) || | 2931 | if (memcg_kmem_online(parent) || |
2929 | memcg_kmem_online(parent)) | 2932 | (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nokmem)) |
2930 | ret = memcg_online_kmem(memcg); | 2933 | ret = memcg_online_kmem(memcg); |
2931 | mutex_unlock(&memcg_limit_mutex); | 2934 | mutex_unlock(&memcg_limit_mutex); |
2932 | return ret; | 2935 | return ret; |
@@ -5638,6 +5641,8 @@ static int __init cgroup_memory(char *s) | |||
5638 | continue; | 5641 | continue; |
5639 | if (!strcmp(token, "nosocket")) | 5642 | if (!strcmp(token, "nosocket")) |
5640 | cgroup_memory_nosocket = true; | 5643 | cgroup_memory_nosocket = true; |
5644 | if (!strcmp(token, "nokmem")) | ||
5645 | cgroup_memory_nokmem = true; | ||
5641 | } | 5646 | } |
5642 | return 0; | 5647 | return 0; |
5643 | } | 5648 | } |