90 lines
2.6 KiB
Diff
90 lines
2.6 KiB
Diff
|
From: Balbir Singh <balbir@linux.vnet.ibm.com>
|
||
|
Date: Thu, 01 May 2008 02:48:58 -0700
|
||
|
Subject: memcg: disable the memory controller by default
|
||
|
Patch-mainline: not yet
|
||
|
|
||
|
Due to the overhead of the memory controller the memory controller is now
|
||
|
disabled by default. This patch adds cgroup_enable.
|
||
|
|
||
|
[akpm@linux-foundation.org: `inline __init' doesn't make sense]
|
||
|
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
|
||
|
Cc: AMAMOTO Takashi <yamamoto@valinux.co.jp>
|
||
|
Acked-by: Paul Menage <menage@google.com>
|
||
|
Cc: Pavel Emelianov <xemul@openvz.org>
|
||
|
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
|
||
|
Cc: <stable@kernel.org>
|
||
|
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
|
||
|
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
|
||
|
---
|
||
|
|
||
|
Documentation/kernel-parameters.txt | 3 +++
|
||
|
kernel/cgroup.c | 17 +++++++++++++----
|
||
|
mm/memcontrol.c | 1 +
|
||
|
3 files changed, 17 insertions(+), 4 deletions(-)
|
||
|
|
||
|
--- a/Documentation/kernel-parameters.txt
|
||
|
+++ b/Documentation/kernel-parameters.txt
|
||
|
@@ -449,8 +449,11 @@ and is between 256 and 4096 characters.
|
||
|
See Documentation/s390/CommonIO for details.
|
||
|
|
||
|
cgroup_disable= [KNL] Disable a particular controller
|
||
|
+ cgroup_enable= [KNL] Enable a particular controller
|
||
|
+ For both cgroup_enable and cgroup_enable
|
||
|
Format: {name of the controller(s) to disable}
|
||
|
{Currently supported controllers - "memory"}
|
||
|
+ {Memory controller is disabled by default}
|
||
|
|
||
|
checkreqprot [SELINUX] Set initial checkreqprot flag value.
|
||
|
Format: { "0" | "1" }
|
||
|
--- a/kernel/cgroup.c
|
||
|
+++ b/kernel/cgroup.c
|
||
|
@@ -4394,7 +4394,7 @@ static void cgroup_release_agent(struct
|
||
|
mutex_unlock(&cgroup_mutex);
|
||
|
}
|
||
|
|
||
|
-static int __init cgroup_disable(char *str)
|
||
|
+static int __init cgroup_turnonoff(char *str, int disable)
|
||
|
{
|
||
|
int i;
|
||
|
char *token;
|
||
|
@@ -4410,17 +4410,26 @@ static int __init cgroup_disable(char *s
|
||
|
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 = disable;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
return 1;
|
||
|
}
|
||
|
+
|
||
|
+static int __init cgroup_disable(char *str)
|
||
|
+{
|
||
|
+ return cgroup_turnonoff(str, 1);
|
||
|
+}
|
||
|
__setup("cgroup_disable=", cgroup_disable);
|
||
|
|
||
|
+static int __init cgroup_enable(char *str)
|
||
|
+{
|
||
|
+ return cgroup_turnonoff(str, 0);
|
||
|
+}
|
||
|
+__setup("cgroup_enable=", cgroup_enable);
|
||
|
+
|
||
|
/*
|
||
|
* Functons for CSS ID.
|
||
|
*/
|
||
|
--- a/mm/memcontrol.c
|
||
|
+++ b/mm/memcontrol.c
|
||
|
@@ -4343,6 +4343,7 @@ struct cgroup_subsys mem_cgroup_subsys =
|
||
|
.attach = mem_cgroup_move_task,
|
||
|
.early_init = 0,
|
||
|
.use_id = 1,
|
||
|
+ .disabled = 1,
|
||
|
};
|
||
|
|
||
|
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
|