mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Acked-by: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
52c29b0482
commit
04823c833b
2 changed files with 8 additions and 2 deletions
|
|
@ -83,6 +83,9 @@ struct mem_cgroup *root_mem_cgroup __read_mostly;
|
|||
/* Socket memory accounting disabled? */
|
||||
static bool cgroup_memory_nosocket;
|
||||
|
||||
/* Kernel memory accounting disabled? */
|
||||
static bool cgroup_memory_nokmem;
|
||||
|
||||
/* Whether the swap controller is active */
|
||||
#ifdef CONFIG_MEMCG_SWAP
|
||||
int do_swap_account __read_mostly;
|
||||
|
|
@ -2925,8 +2928,8 @@ static int memcg_propagate_kmem(struct mem_cgroup *memcg)
|
|||
* onlined after this point, because it has at least one child
|
||||
* already.
|
||||
*/
|
||||
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) ||
|
||||
memcg_kmem_online(parent))
|
||||
if (memcg_kmem_online(parent) ||
|
||||
(cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nokmem))
|
||||
ret = memcg_online_kmem(memcg);
|
||||
mutex_unlock(&memcg_limit_mutex);
|
||||
return ret;
|
||||
|
|
@ -5638,6 +5641,8 @@ static int __init cgroup_memory(char *s)
|
|||
continue;
|
||||
if (!strcmp(token, "nosocket"))
|
||||
cgroup_memory_nosocket = true;
|
||||
if (!strcmp(token, "nokmem"))
|
||||
cgroup_memory_nokmem = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue