We don't want memory cgroup support to be enabled by default, due to the run-time overhead. Below is a patch that allows the code to be included but disabled by default. However, memory cgroup support still has some run-time cost when included but disabled, which we need to evaluate before making this change.
Ben. diff --git a/init/Kconfig b/init/Kconfig index eb4b337..47b2dcf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -579,6 +579,14 @@ config CGROUP_MEM_RES_CTLR This config option also selects MM_OWNER config option, which could in turn add some fork/exit overhead. +config CGROUP_MEM_RES_CTLR_DISABLED + bool "Memory Resource Controller disabled by default" + depends on CGROUP_MEM_RES_CTLR + default n + help + Disable the memory group resource controller unless explicitly + enabled using the kernel parameter "cgroup_enable=memory". + config CGROUP_MEM_RES_CTLR_SWAP bool "Memory Resource Controller Swap Extension(EXPERIMENTAL)" depends on CGROUP_MEM_RES_CTLR && SWAP && EXPERIMENTAL diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 1fbcc74..4f6be6c 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -3791,7 +3791,7 @@ static void cgroup_release_agent(struct work_struct *work) mutex_unlock(&cgroup_mutex); } -static int __init cgroup_disable(char *str) +static int __init cgroup_set_disabled(char *str, int value) { int i; char *token; @@ -3804,17 +3804,29 @@ static int __init cgroup_disable(char *str) struct cgroup_subsys *ss = subsys[i]; if (!strcmp(token, ss->name)) { - ss->disabled = 1; - printk(KERN_INFO "Disabling %s control group" - " subsystem\n", ss->name); + ss->disabled = value; + printk(KERN_INFO + "%sabling %s control group subsystem\n", + value ? "Dis" : "En", ss->name); break; } } } return 1; } + +static int __init cgroup_disable(char *str) +{ + cgroup_set_disabled(str, 1); +} __setup("cgroup_disable=", cgroup_disable); +static int __init cgroup_enable(char *str) +{ + cgroup_set_disabled(str, 0); +} +__setup("cgroup_enable=", cgroup_enable); + /* * Functons for CSS ID. */ diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 66035bf..58897ce 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3184,6 +3184,9 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, struct cgroup_subsys mem_cgroup_subsys = { .name = "memory", +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_DISABLED + .disabled = 1, +#endif .subsys_id = mem_cgroup_subsys_id, .create = mem_cgroup_create, .pre_destroy = mem_cgroup_pre_destroy, --- END --- -- Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
signature.asc
Description: This is a digitally signed message part