diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 3ea869d7a31c4019c0ed768050b930a370931521..cfb2c0f1a4a89237ce131999d7b1cc03aff178b4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -611,6 +611,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. cgroup.memory= [KNL] Pass options to the cgroup memory controller. Format: nosocket -- Disable socket memory accounting. + nokmem -- Disable kernel memory accounting. checkreqprot [SELINUX] Set initial checkreqprot flag value. Format: { "0" | "1" } diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9e7a4e5219170955bc640dd1dc43b15bc2b174e7..2239e6dd4d4c12a9153aec137c7e404d175b07de 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -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; }