]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
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 | |
4 | ||
5 | Due to the overhead of the memory controller the memory controller is now | |
6 | disabled by default. This patch adds cgroup_enable. | |
7 | ||
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> | |
17 | --- | |
18 | ||
19 | Documentation/kernel-parameters.txt | 3 +++ | |
20 | kernel/cgroup.c | 17 +++++++++++++---- | |
21 | mm/memcontrol.c | 1 + | |
22 | 3 files changed, 17 insertions(+), 4 deletions(-) | |
23 | ||
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. | |
28 | ||
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} | |
35 | ||
36 | checkreqprot [SELINUX] Set initial checkreqprot flag value. | |
37 | Format: { "0" | "1" } | |
38 | --- a/kernel/cgroup.c | |
39 | +++ b/kernel/cgroup.c | |
40 | @@ -3099,7 +3099,7 @@ static void cgroup_release_agent(struct | |
41 | mutex_unlock(&cgroup_mutex); | |
42 | } | |
43 | ||
44 | -static int __init cgroup_disable(char *str) | |
45 | +static int __init cgroup_turnonoff(char *str, int disable) | |
46 | { | |
47 | int i; | |
48 | char *token; | |
49 | @@ -3112,13 +3112,22 @@ static int __init cgroup_disable(char *s | |
50 | struct cgroup_subsys *ss = subsys[i]; | |
51 | ||
52 | if (!strcmp(token, ss->name)) { | |
53 | - ss->disabled = 1; | |
54 | - printk(KERN_INFO "Disabling %s control group" | |
55 | - " subsystem\n", ss->name); | |
56 | + ss->disabled = disable; | |
57 | break; | |
58 | } | |
59 | } | |
60 | } | |
61 | return 1; | |
62 | } | |
63 | + | |
64 | +static int __init cgroup_disable(char *str) | |
65 | +{ | |
66 | + return cgroup_turnonoff(str, 1); | |
67 | +} | |
68 | __setup("cgroup_disable=", cgroup_disable); | |
69 | + | |
70 | +static int __init cgroup_enable(char *str) | |
71 | +{ | |
72 | + return cgroup_turnonoff(str, 0); | |
73 | +} | |
74 | +__setup("cgroup_enable=", cgroup_enable); | |
75 | --- a/mm/memcontrol.c | |
76 | +++ b/mm/memcontrol.c | |
77 | @@ -1241,4 +1241,5 @@ struct cgroup_subsys mem_cgroup_subsys = | |
78 | .populate = mem_cgroup_populate, | |
79 | .attach = mem_cgroup_move_task, | |
80 | .early_init = 0, | |
81 | + .disabled = 1, | |
82 | }; |