Skip to contentSkip to conversation

Disable the memory controller by default (v2)

-mm Balbir Singh 4 participants 5 messages Apr 7, 2008 – Apr 8, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Changelog v1

1. Split cgroup_disable into cgroup_disable and cgroup_enable
2. Remove cgroup_toggle

Due to the overhead of the memory controller. The
memory controller is now disabled by default. This patch adds cgroup_enable.

If everyone agrees on this approach and likes it, should we push this into 2.6.25?

---

 Documentation/kernel-parameters.txt |    3 +++
 kernel/cgroup.c                     |   28 ++++++++++++++++++++++++++--
 mm/memcontrol.c                     |    1 +
 3 files changed, 30 insertions(+), 2 deletions(-)
kernel/cgroup.c renamed from kernel/cgroup.c~memory-controller-default-option-off +26 -2
diff -puN kernel/cgroup.c~memory-controller-default-option-off kernel/cgroup.c
@@ -3077,8 +3077,8 @@ static int __init cgroup_disable(char *s
 
 			if (!strcmp(token, ss->name)) {
 				ss->disabled = 1;
-				printk(KERN_INFO "Disabling %s control group"
-					" subsystem\n", ss->name);
+				printk(KERN_INFO "%s control group "
+						"is disabled\n", ss->name);
 				break;
 			}
 		}
@@ -3086,3 +3086,27 @@ static int __init cgroup_disable(char *s
 	return 1;
 }
 __setup("cgroup_disable=", cgroup_disable);
+
+static int __init cgroup_enable(char *str)
+{
+	int i;
+	char *token;
+
+	while ((token = strsep(&str, ",")) != NULL) {
+		if (!*token)
+			continue;
+
+		for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+			struct cgroup_subsys *ss = subsys[i];
+
+			if (!strcmp(token, ss->name)) {
+				ss->disabled = 0;
+				printk(KERN_INFO "%s control group "
+						"is enabled\n", ss->name);
+				break;
+			}
+		}
+	}
+	return 1;
+}
+__setup("cgroup_enable=", cgroup_enable);
mm/memcontrol.c renamed from mm/memcontrol.c~memory-controller-default-option-off +1 -0
diff -puN mm/memcontrol.c~memory-controller-default-option-off mm/memcontrol.c
@@ -1104,4 +1104,5 @@ struct cgroup_subsys mem_cgroup_subsys =
 	.populate = mem_cgroup_populate,
 	.attach = mem_cgroup_move_task,
 	.early_init = 0,
+	.disabled = 1,
 };
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~memory-controller-default-option-off +3 -0
diff -puN Documentation/kernel-parameters.txt~memory-controller-default-option-off Documentation/kernel-parameters.txt
@@ -382,8 +382,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" }

_

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
#1 lore raw
Quoted 10 lines

Changelog v1

1. Split cgroup_disable into cgroup_disable and cgroup_enable
2. Remove cgroup_toggle

Due to the overhead of the memory controller. The
memory controller is now disabled by default. This patch adds cgroup_enable.

If everyone agrees on this approach and likes it, should we push this into 2.6.25?

#2 lore raw
In reply to Balbir Singh
Quoted 19 lines · Balbir Singh
        return 1;

}
__setup("cgroup_disable=", cgroup_disable);
+
+static int __init cgroup_enable(char *str)
+{
+ int i;
+ char *token;
+
+ while ((token = strsep(&str, ",")) != NULL) {
+ if (!*token)
+ continue;
+
+ for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+ struct cgroup_subsys *ss = subsys[i];
+
+ if (!strcmp(token, ss->name)) {
+ ss->disabled = 0;
+ printk(KERN_INFO "%s control group "

Quoted 8 lines

+ "is enabled\n", ss->name);
+ break;
+ }
+ }
+ }
+ return 1;
+}
+__setup("cgroup_enable=", cgroup_enable);

Good idea - but you could just use the same handler function for both of these (with a one-line wrapper for each to pass disabled=1 or disabled=0)

Paul

#3 lore raw
In reply to Balbir Singh
Quoted 7 lines · On Mon, 07 Apr 2008 18:32:15 +0530 Balbir Singh <[email protected]>…

Changelog v1

1. Split cgroup_disable into cgroup_disable and cgroup_enable
2. Remove cgroup_toggle

Quoted 8 lines

Due to the overhead of the memory controller. The
memory controller is now disabled by default. This patch adds cgroup_enable.

If everyone agrees on this approach and likes it, should we push this into 2.6.25?

---

BTW, how the user can know which controllers are on/off at default ? All controllers are off ?

Thanks,
-Kame

#4 lore raw
Quoted 12 lines · KAMEZAWA Hiroyuki
Quoted 9 lines · On Mon, 07 Apr 2008 18:32:15 +0530 Balbir Singh <[email protected]>…

Changelog v1

1. Split cgroup_disable into cgroup_disable and cgroup_enable
2. Remove cgroup_toggle

Due to the overhead of the memory controller. The
memory controller is now disabled by default. This patch adds cgroup_enable.

Quoted 8 lines
Quoted 5 lines

If everyone agrees on this approach and likes it, should we push this into 2.6.25?

---

BTW, how the user can know which controllers are on/off at default ? All controllers are off ?

/proc/cgroups has an enabled field (fourth one). That should show what is enabled/disabled. I've also documented it in Documentation/kernel-parameters.txt. I intend to enable the memory controller again, once we bring down the overhead.

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL