1 From: Balbir Singh <balbir@linux.vnet.ibm.com>
2 Date: Thu, 01 May 2008 02:48:58 -0700
3 Subject: memcg: disable the memory controller by default
5 Due to the overhead of the memory controller the memory controller is now
6 disabled by default. This patch adds cgroup_enable.
8 [akpm@linux-foundation.org: `inline __init' doesn't make sense]
9 Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
10 Cc: AMAMOTO Takashi <yamamoto@valinux.co.jp>
11 Acked-by: Paul Menage <menage@google.com>
12 Cc: Pavel Emelianov <xemul@openvz.org>
13 Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
14 Cc: <stable@kernel.org>
15 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
16 Signed-off-by: Jiri Slaby <jslaby@suse.cz>
19 Documentation/kernel-parameters.txt | 3 +++
20 kernel/cgroup.c | 17 +++++++++++++----
22 3 files changed, 17 insertions(+), 4 deletions(-)
24 --- a/Documentation/kernel-parameters.txt
25 +++ b/Documentation/kernel-parameters.txt
26 @@ -423,8 +423,11 @@ and is between 256 and 4096 characters.
27 See Documentation/s390/CommonIO for details.
29 cgroup_disable= [KNL] Disable a particular controller
30 + cgroup_enable= [KNL] Enable a particular controller
31 + For both cgroup_enable and cgroup_enable
32 Format: {name of the controller(s) to disable}
33 {Currently supported controllers - "memory"}
34 + {Memory controller is disabled by default}
36 checkreqprot [SELINUX] Set initial checkreqprot flag value.
40 @@ -3099,7 +3099,7 @@ static void cgroup_release_agent(struct
41 mutex_unlock(&cgroup_mutex);
44 -static int __init cgroup_disable(char *str)
45 +static int __init cgroup_turnonoff(char *str, int disable)
49 @@ -3112,13 +3112,22 @@ static int __init cgroup_disable(char *s
50 struct cgroup_subsys *ss = subsys[i];
52 if (!strcmp(token, ss->name)) {
54 - printk(KERN_INFO "Disabling %s control group"
55 - " subsystem\n", ss->name);
56 + ss->disabled = disable;
64 +static int __init cgroup_disable(char *str)
66 + return cgroup_turnonoff(str, 1);
68 __setup("cgroup_disable=", cgroup_disable);
70 +static int __init cgroup_enable(char *str)
72 + return cgroup_turnonoff(str, 0);
74 +__setup("cgroup_enable=", cgroup_enable);
77 @@ -1241,4 +1241,5 @@ struct cgroup_subsys mem_cgroup_subsys =
78 .populate = mem_cgroup_populate,
79 .attach = mem_cgroup_move_task,