Skip to contentSkip to conversation

Add cgroup support for enabling controllers at boot time

PATCH In review Balbir Singh 6 participants 16 messages Mar 6, 2008 – Mar 7, 2008

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

PATCH 1/1 Add cgroup support for enabling controllers at boot time

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)
include/linux/cgroup.h renamed from include/linux/cgroup.h~cgroup_disable +1 -0
diff -puN include/linux/cgroup.h~cgroup_disable include/linux/cgroup.h
@@ -256,6 +256,7 @@ struct cgroup_subsys {
 	void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
 	int subsys_id;
 	int active;
+	int disabled;
 	int early_init;
 #define MAX_CGROUP_TYPE_NAMELEN 32
 	const char *name;
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +25 -2
diff -puN kernel/cgroup.c~cgroup_disable kernel/cgroup.c
@@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *
 		if (!*token)
 			return -EINVAL;
 		if (!strcmp(token, "all")) {
-			opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1;
+			/* Add all non-disabled subsystems */
+			int i;
+			opts->subsys_bits = 0;
+			for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+				struct cgroup_subsys *ss = subsys[i];
+				if (!ss->disabled)
+					opts->subsys_bits |= 1ul << i;
+			}
 		} else if (!strcmp(token, "noprefix")) {
 			set_bit(ROOT_NOPREFIX, &opts->flags);
 		} else if (!strncmp(token, "release_agent=", 14)) {
@@ -800,7 +807,8 @@ static int parse_cgroupfs_options(char *
 			for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
 				ss = subsys[i];
 				if (!strcmp(token, ss->name)) {
-					set_bit(i, &opts->subsys_bits);
+					if (!ss->disabled)
+						set_bit(i, &opts->subsys_bits);
 					break;
 				}
 			}
@@ -2604,6 +2612,8 @@ static int proc_cgroupstats_show(struct 
 	mutex_lock(&cgroup_mutex);
 	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
 		struct cgroup_subsys *ss = subsys[i];
+		if (ss->disabled)
+			continue;
 		seq_printf(m, "%s\t%lu\t%d\n",
 			   ss->name, ss->root->subsys_bits,
 			   ss->root->number_of_cgroups);
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
+		}
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
+	cgroup_disable= [KNL] Enable disable a particular controller
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+
 	checkreqprot	[SELINUX] Set initial checkreqprot flag value.
 			Format: { "0" | "1" }
 			See security/selinux/Kconfig help text.

_

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw

PATCH 1/1 Make memory resource control aware of boot options

A boot option for the memory controller was discussed on lkml. It is a good idea to add it, since it saves memory for people who want to turn off the memory controller.

By default the option is on for the following two reasons

1. It provides compatibility with the current scheme where the memory controller turns on if the config option is enabled
2. It allows for wider testing of the memory controller, once the config option is enabled

We still allow the create, destroy callbacks to succeed, since they are not aware of boot options. We do not populate the directory will memory resource controller specific files.

---

 mm/memcontrol.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
mm/memcontrol.c renamed from mm/memcontrol.c~memory-controller-add-boot-option +17 -0
diff -puN mm/memcontrol.c~memory-controller-add-boot-option mm/memcontrol.c
@@ -533,6 +533,9 @@ static int mem_cgroup_charge_common(stru
 	unsigned long nr_retries = MEM_CGROUP_RECLAIM_RETRIES;
 	struct mem_cgroup_per_zone *mz;
 
+	if (mem_cgroup_subsys.disabled)
+		return 0;
+
 	/*
 	 * Should page_cgroup's go to their own slab?
 	 * One could optimize the performance of the charging routine
@@ -665,6 +668,9 @@ void mem_cgroup_uncharge_page(struct pag
 	struct mem_cgroup_per_zone *mz;
 	unsigned long flags;
 
+	if (mem_cgroup_subsys.disabled)
+		return;
+
 	/*
 	 * Check if our page_cgroup is valid
 	 */
@@ -705,6 +711,9 @@ int mem_cgroup_prepare_migration(struct 
 {
 	struct page_cgroup *pc;
 
+	if (mem_cgroup_subsys.disabled)
+		return 0;
+
 	lock_page_cgroup(page);
 	pc = page_get_page_cgroup(page);
 	if (pc)
@@ -803,6 +812,9 @@ static int mem_cgroup_force_empty(struct
 	int ret = -EBUSY;
 	int node, zid;
 
+	if (mem_cgroup_subsys.disabled)
+		return 0;
+
 	css_get(&mem->css);
 	/*
 	 * page reclaim code (kswapd etc..) will move pages between
@@ -1053,6 +1065,8 @@ static void mem_cgroup_destroy(struct cg
 static int mem_cgroup_populate(struct cgroup_subsys *ss,
 				struct cgroup *cont)
 {
+	if (mem_cgroup_subsys.disabled)
+		return 0;
 	return cgroup_add_files(cont, ss, mem_cgroup_files,
 					ARRAY_SIZE(mem_cgroup_files));
 }
@@ -1065,6 +1079,9 @@ static void mem_cgroup_move_task(struct 
 	struct mm_struct *mm;
 	struct mem_cgroup *mem, *old_mem;
 
+	if (mem_cgroup_subsys.disabled)
+		return;
+
 	mm = get_task_mm(p);
 	if (mm == NULL)
 		return;

_

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw
In reply to Balbir Singh
Quoted 7 lines · Balbir Singh
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +3 -0
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{

kernel/cgroup.c static void cgroup_release_agent(struct · line 3035

Quoted 10 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +10 -0
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
+		}
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

This doesn't handle spaces very well, so isn't it possible for the name of a current or future cgroup subsystem to be specified after cgroup_disable= on the command line and have it disabled by accident?

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 389

Quoted 11 lines

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt

Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
+	cgroup_disable= [KNL] Enable disable a particular controller
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+

This works on multiple controllers, though, if they follow cgroup_disable=, so the documentation and format should reflect that.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw
Quoted 15 lines · David Rientjes
Quoted 13 lines · Balbir Singh
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +9 -0
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
Quoted 9 lines

kernel/cgroup.c static void cgroup_release_agent(struct · line 3035

Quoted 4 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +4 -0
+		}
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

This doesn't handle spaces very well, so isn't it possible for the name of a current or future cgroup subsystem to be specified after cgroup_disable= on the command line and have it disabled by accident?

How do you distinguish that from the user wanting to disable the controller on purpose? My understanding is that after parsing cgroup_disable=, the rest of the text is passed to cgroup_disable to process further. You'll find that all the __setup() code in the kernel is implemented this way.

Quoted 7 lines
Quoted 7 lines

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt

Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +0 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
Quoted 7 lines

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 389

Quoted 4 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
+	cgroup_disable= [KNL] Enable disable a particular controller
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+

This works on multiple controllers, though, if they follow cgroup_disable=, so the documentation and format should reflect that.

Absolutely! done.

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
Quoted 17 lines · On Fri, 07 Mar 2008 10:11:17 +0530 Balbir Singh <[email protected]>…
Quoted 16 lines · David Rientjes
Quoted 14 lines · Balbir Singh
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +10 -0
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
+		}
Quoted 9 lines
Quoted 8 lines

kernel/cgroup.c static void cgroup_release_agent(struct · line 3035

Quoted 3 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +3 -0
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

This doesn't handle spaces very well, so isn't it possible for the name of a current or future cgroup subsystem to be specified after cgroup_disable= on the command line and have it disabled by accident?

Hmm, cmdline like

cgroup_disable=cpu,memory, ...

should be written as

cgroup_disable=cpu cgroup_disable=memory ....

?
Thanks,
-Kame

#5 lore raw
Quoted 26 lines · KAMEZAWA Hiroyuki
Quoted 17 lines
Quoted 16 lines · David Rientjes
Quoted 14 lines · Balbir Singh
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +10 -0
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
+		}
Quoted 9 lines
Quoted 8 lines

kernel/cgroup.c static void cgroup_release_agent(struct · line 3035

Quoted 3 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +3 -0
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

This doesn't handle spaces very well, so isn't it possible for the name of a current or future cgroup subsystem to be specified after cgroup_disable= on the command line and have it disabled by accident?

Quoted 8 lines

Hmm, cmdline like

cgroup_disable=cpu,memory, ...

should be written as

cgroup_disable=cpu cgroup_disable=memory ....

Or just set the first space following cgroup_disable= to '\0' and you're done. strcmp() will take care of the rest.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw
In reply to Balbir Singh
Quoted 18 lines · Balbir Singh
Quoted 8 lines
Quoted 8 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +8 -0
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
Quoted 9 lines

kernel/cgroup.c static void cgroup_release_agent(struct · line 3035

Quoted 4 lines
kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +4 -0
+		}
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

This doesn't handle spaces very well, so isn't it possible for the name of a current or future cgroup subsystem to be specified after cgroup_disable= on the command line and have it disabled by accident?

Quoted 5 lines

How do you distinguish that from the user wanting to disable the controller on purpose? My understanding is that after parsing cgroup_disable=, the rest of the text is passed to cgroup_disable to process further. You'll find that all the __setup() code in the kernel is implemented this way.

Since the command line is logically delimited by spaces, you can accidently disable a subsystem if its name appears in any of your kernel options following your cgroup_disable= option. So if you're absolutely confident that it wouldn't happen (for instance, if there's no logical reason that a cgroup subsystem name should appear anywhere besides cgroup_disable on the command line), then there's no objection.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw
Quoted 4 lines · David Rientjes

Since the command line is logically delimited by spaces, you can accidently disable a subsystem if its name appears in any of your kernel options following your cgroup_disable= option.

I think that you're confusing this with things like the very early memory init setup parameters, which do operate on the raw commandline.

By the time anything is passed to a __setup() function, it's already been split into separate strings at space boundaries.

Paul

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw
Quoted 10 lines · Paul Menage
Quoted 3 lines

Since the command line is logically delimited by spaces, you can accidently disable a subsystem if its name appears in any of your kernel options following your cgroup_disable= option.

I think that you're confusing this with things like the very early memory init setup parameters, which do operate on the raw commandline.

By the time anything is passed to a __setup() function, it's already been split into separate strings at space boundaries.

Ok, so the cgroup_disable= parameter should be a list of subsystem names delimited by anything other than a space that the user wants disabled. That makes more sense, thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw
Quoted 5 lines · David Rientjes

Ok, so the cgroup_disable= parameter should be a list of subsystem names delimited by anything other than a space that the user wants disabled. That makes more sense, thanks.

As the code stands now, it should be just a single name. Disabling multiple subsystems requires multiple cgroup_disable= options.

Paul

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#10 lore raw
In reply to Balbir Singh
Quoted 34 lines · On Fri, 07 Mar 2008 00:29:52 +0530 Balbir Singh wrote:

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 386

Quoted 4 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +1 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
+	cgroup_disable= [KNL] Enable disable a particular controller

So it can enable or disable? or the text has extra text?

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 392

Quoted 6 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +3 -0
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+
 	checkreqprot	[SELINUX] Set initial checkreqprot flag value.
 			Format: { "0" | "1" }
 			See security/selinux/Kconfig help text.

---
~Randy

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#11 lore raw
Quoted 39 lines · Randy Dunlap
Quoted 37 lines · On Fri, 07 Mar 2008 00:29:52 +0530 Balbir Singh wrote:

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt

Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +0 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
Quoted 4 lines

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 386

Quoted 1 line
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +1 -0
+	cgroup_disable= [KNL] Enable disable a particular controller

So it can enable or disable? or the text has extra text?

don't think so, should be "Disable a particular controller"

Quoted 12 lines

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 392

Quoted 6 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +3 -0
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+
 	checkreqprot	[SELINUX] Set initial checkreqprot flag value.
 			Format: { "0" | "1" }
 			See security/selinux/Kconfig help text.

---
~Randy

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#12 lore raw
Quoted 45 lines · Li Zefan
Quoted 44 lines · Randy Dunlap
Quoted 42 lines · On Fri, 07 Mar 2008 00:29:52 +0530 Balbir Singh wrote:

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init
systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt
---
linux-2.6.25-rc4/Documentation/kernel-parameters.txt~cgroup_disable

2008-03-06 17:57:32.000000000 +0530
+++ linux-2.6.25-rc4-balbir/Documentation/kernel-parameters.txt   
2008-03-06 18:00:32.000000000 +0530
(quoted diff) +0 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters.     

ccw_timeout_log [S390]
See Documentation/s390/CommonIO for details.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

+ cgroup_disable= [KNL] Enable disable a particular controller

So it can enable or disable? or the text has extra text?

don't think so, should be "Disable a particular controller"

Agreed and fixed.

Thanks,

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#13 lore raw
In reply to Balbir Singh
Quoted 100 lines · Balbir Singh

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN include/linux/cgroup.h~cgroup_disable include/linux/cgroup.h

include/linux/cgroup.h renamed from include/linux/cgroup.h~cgroup_disable +1 -0
@@ -256,6 +256,7 @@ struct cgroup_subsys {
 	void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
 	int subsys_id;
 	int active;
+	int disabled;
 	int early_init;
 #define MAX_CGROUP_TYPE_NAMELEN 32
 	const char *name;

diff -puN kernel/cgroup.c~cgroup_disable kernel/cgroup.c

kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +25 -2
@@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *
 		if (!*token)
 			return -EINVAL;
 		if (!strcmp(token, "all")) {
-			opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1;
+			/* Add all non-disabled subsystems */
+			int i;
+			opts->subsys_bits = 0;
+			for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+				struct cgroup_subsys *ss = subsys[i];
+				if (!ss->disabled)
+					opts->subsys_bits |= 1ul << i;
+			}
 		} else if (!strcmp(token, "noprefix")) {
 			set_bit(ROOT_NOPREFIX, &opts->flags);
 		} else if (!strncmp(token, "release_agent=", 14)) {
@@ -800,7 +807,8 @@ static int parse_cgroupfs_options(char *
 			for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
 				ss = subsys[i];
 				if (!strcmp(token, ss->name)) {
-					set_bit(i, &opts->subsys_bits);
+					if (!ss->disabled)
+						set_bit(i, &opts->subsys_bits);
 					break;
 				}
 			}
@@ -2604,6 +2612,8 @@ static int proc_cgroupstats_show(struct 
 	mutex_lock(&cgroup_mutex);
 	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
 		struct cgroup_subsys *ss = subsys[i];
+		if (ss->disabled)
+			continue;
 		seq_printf(m, "%s\t%lu\t%d\n",
 			   ss->name, ss->root->subsys_bits,
 			   ss->root->number_of_cgroups);
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct 
 	spin_unlock(&release_list_lock);
 	mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+	int i;
+	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+		struct cgroup_subsys *ss = subsys[i];
+		if (!strcmp(str, ss->name)) {
+			ss->disabled = 1;
+			break;
+		}
+	}
+}
+__setup("cgroup_disable=", cgroup_disable);

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 389

Quoted 7 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters. 
 	ccw_timeout_log [S390]
 			See Documentation/s390/CommonIO for details.
 
+	cgroup_disable= [KNL] Enable disable a particular controller
+			Format: {name of the controller}
+			See /proc/cgroups for a list of compiled controllers
+

The changelog of this patch:
- foo doesn't show up in /proc/cgroups

So a disabled subsystem won't show up in /proc/cgroups. In a previous mail, I asked whether it will be useful to print out the disable bit in /proc/cgroups, so we can distinguish a subsystem from disaled and not-compiled.

Quoted 5 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +0 -0
 	checkreqprot	[SELINUX] Set initial checkreqprot flag value.
 			Format: { "0" | "1" }
 			See security/selinux/Kconfig help text.

_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#14 lore raw
Quoted 120 lines · Li Zefan
Quoted 111 lines · Balbir Singh

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN include/linux/cgroup.h~cgroup_disable include/linux/cgroup.h --- linux-2.6.25-rc4/include/linux/cgroup.h~cgroup_disable

2008-03-06 12:19:38.000000000 +0530

+++ linux-2.6.25-rc4-balbir/include/linux/cgroup.h 2008-03-06
12:19:38.000000000 +0530

include/linux/cgroup.h renamed from include/linux/cgroup.h~cgroup_disable +1 -0
@@ -256,6 +256,7 @@ struct cgroup_subsys {
     void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
     int subsys_id;
     int active;
+    int disabled;
     int early_init;
 #define MAX_CGROUP_TYPE_NAMELEN 32
     const char *name;

diff -puN kernel/cgroup.c~cgroup_disable kernel/cgroup.c
--- linux-2.6.25-rc4/kernel/cgroup.c~cgroup_disable 2008-03-06
12:19:38.000000000 +0530
+++ linux-2.6.25-rc4-balbir/kernel/cgroup.c 2008-03-06
12:19:38.000000000 +0530

kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +25 -2
@@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *
         if (!*token)
             return -EINVAL;
         if (!strcmp(token, "all")) {
-            opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1;
+            /* Add all non-disabled subsystems */
+            int i;
+            opts->subsys_bits = 0;
+            for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+                struct cgroup_subsys *ss = subsys[i];
+                if (!ss->disabled)
+                    opts->subsys_bits |= 1ul << i;
+            }
         } else if (!strcmp(token, "noprefix")) {
             set_bit(ROOT_NOPREFIX, &opts->flags);
         } else if (!strncmp(token, "release_agent=", 14)) {
@@ -800,7 +807,8 @@ static int parse_cgroupfs_options(char *
             for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
                 ss = subsys[i];
                 if (!strcmp(token, ss->name)) {
-                    set_bit(i, &opts->subsys_bits);
+                    if (!ss->disabled)
+                        set_bit(i, &opts->subsys_bits);
                     break;
                 }
             }
@@ -2604,6 +2612,8 @@ static int proc_cgroupstats_show(struct     
 mutex_lock(&cgroup_mutex);
     for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
         struct cgroup_subsys *ss = subsys[i];
+        if (ss->disabled)
+            continue;
         seq_printf(m, "%s\t%lu\t%d\n",
                ss->name, ss->root->subsys_bits,
                ss->root->number_of_cgroups);
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct     
 spin_unlock(&release_list_lock);
     mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+    int i;
+    for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+        struct cgroup_subsys *ss = subsys[i];
+        if (!strcmp(str, ss->name)) {
+            ss->disabled = 1;
+            break;
+        }
+    }
+}
+__setup("cgroup_disable=", cgroup_disable);

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt
---
linux-2.6.25-rc4/Documentation/kernel-parameters.txt~cgroup_disable

2008-03-06 17:57:32.000000000 +0530
+++ linux-2.6.25-rc4-balbir/Documentation/kernel-parameters.txt   
2008-03-06 18:00:32.000000000 +0530
(quoted diff) +0 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters.     

ccw_timeout_log [S390]
See Documentation/s390/CommonIO for details.

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 389

Quoted 4 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
+    cgroup_disable= [KNL] Enable disable a particular controller
+            Format: {name of the controller}
+            See /proc/cgroups for a list of compiled controllers
+

The changelog of this patch:
- foo doesn't show up in /proc/cgroups

Quoted 4 lines

So a disabled subsystem won't show up in /proc/cgroups. In a previous mail, I asked whether it will be useful to print out the disable bit in /proc/cgroups, so we can distinguish a subsystem from disaled and not-compiled.

Hi, Li,

That is a good idea, but can that come in later? We need to get the boot option in, so that users can decide at boot time whether they want the page_container overhead. I'll send out another set of patches to add that feature or work with Paul to see what he thinks about it.

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#15 lore raw
Quoted 125 lines · Balbir Singh
Quoted 119 lines · Li Zefan
Quoted 111 lines · Balbir Singh

From: Paul Menage <[email protected]>

The effects of cgroup_disable=foo are:

- foo doesn't show up in /proc/cgroups
- foo isn't auto-mounted if you mount all cgroups in a single hierarchy
- foo isn't visible as an individually mountable subsystem

As a result there will only ever be one call to foo->create(), at init time; all processes will stay in this group, and the group will never be mounted on a visible hierarchy. Any additional effects (e.g. not allocating metadata) are up to the foo subsystem.

This doesn't handle early_init subsystems (their "disabled" bit isn't set be, but it could easily be extended to do so if any of the early_init systems wanted it - I think it would just involve some nastier parameter processing since it would occur before the command-line argument parser had been run.

[Balbir added Documentation/kernel-parameters updates]

---

 Documentation/kernel-parameters.txt |    4 ++++
 include/linux/cgroup.h              |    1 +
 kernel/cgroup.c                     |   27 +++++++++++++++++++++++++--
 3 files changed, 30 insertions(+), 2 deletions(-)

diff -puN include/linux/cgroup.h~cgroup_disable include/linux/cgroup.h --- linux-2.6.25-rc4/include/linux/cgroup.h~cgroup_disable

2008-03-06 12:19:38.000000000 +0530

+++ linux-2.6.25-rc4-balbir/include/linux/cgroup.h 2008-03-06
12:19:38.000000000 +0530

include/linux/cgroup.h renamed from include/linux/cgroup.h~cgroup_disable +1 -0
@@ -256,6 +256,7 @@ struct cgroup_subsys {
     void (*bind)(struct cgroup_subsys *ss, struct cgroup *root);
     int subsys_id;
     int active;
+    int disabled;
     int early_init;
 #define MAX_CGROUP_TYPE_NAMELEN 32
     const char *name;

diff -puN kernel/cgroup.c~cgroup_disable kernel/cgroup.c
--- linux-2.6.25-rc4/kernel/cgroup.c~cgroup_disable 2008-03-06
12:19:38.000000000 +0530
+++ linux-2.6.25-rc4-balbir/kernel/cgroup.c 2008-03-06
12:19:38.000000000 +0530

kernel/cgroup.c renamed from kernel/cgroup.c~cgroup_disable +25 -2
@@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *
         if (!*token)
             return -EINVAL;
         if (!strcmp(token, "all")) {
-            opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1;
+            /* Add all non-disabled subsystems */
+            int i;
+            opts->subsys_bits = 0;
+            for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+                struct cgroup_subsys *ss = subsys[i];
+                if (!ss->disabled)
+                    opts->subsys_bits |= 1ul << i;
+            }
         } else if (!strcmp(token, "noprefix")) {
             set_bit(ROOT_NOPREFIX, &opts->flags);
         } else if (!strncmp(token, "release_agent=", 14)) {
@@ -800,7 +807,8 @@ static int parse_cgroupfs_options(char *
             for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
                 ss = subsys[i];
                 if (!strcmp(token, ss->name)) {
-                    set_bit(i, &opts->subsys_bits);
+                    if (!ss->disabled)
+                        set_bit(i, &opts->subsys_bits);
                     break;
                 }
             }
@@ -2604,6 +2612,8 @@ static int proc_cgroupstats_show(struct     
 mutex_lock(&cgroup_mutex);
     for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
         struct cgroup_subsys *ss = subsys[i];
+        if (ss->disabled)
+            continue;
         seq_printf(m, "%s\t%lu\t%d\n",
                ss->name, ss->root->subsys_bits,
                ss->root->number_of_cgroups);
@@ -3010,3 +3020,16 @@ static void cgroup_release_agent(struct     
 spin_unlock(&release_list_lock);
     mutex_unlock(&cgroup_mutex);
 }
+
+static int __init cgroup_disable(char *str)
+{
+    int i;
+    for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
+        struct cgroup_subsys *ss = subsys[i];
+        if (!strcmp(str, ss->name)) {
+            ss->disabled = 1;
+            break;
+        }
+    }
+}
+__setup("cgroup_disable=", cgroup_disable);

diff -puN Documentation/kernel-parameters.txt~cgroup_disable Documentation/kernel-parameters.txt
---
linux-2.6.25-rc4/Documentation/kernel-parameters.txt~cgroup_disable

2008-03-06 17:57:32.000000000 +0530
+++ linux-2.6.25-rc4-balbir/Documentation/kernel-parameters.txt   
2008-03-06 18:00:32.000000000 +0530
(quoted diff) +0 -0
@@ -383,6 +383,10 @@ and is between 256 and 4096 characters.     

ccw_timeout_log [S390]
See Documentation/s390/CommonIO for details.

Documentation/kernel-parameters.txt and is between 256 and 4096 characters. · line 389

Quoted 4 lines
Documentation/kernel-parameters.txt renamed from Documentation/kernel-parameters.txt~cgroup_disable +4 -0
+    cgroup_disable= [KNL] Enable disable a particular controller
+            Format: {name of the controller}
+            See /proc/cgroups for a list of compiled controllers
+

The changelog of this patch:
- foo doesn't show up in /proc/cgroups

Quoted 4 lines

So a disabled subsystem won't show up in /proc/cgroups. In a previous mail, I asked whether it will be useful to print out the disable bit in /proc/cgroups, so we can distinguish a subsystem from disaled and not-compiled.

Quoted 7 lines

Hi, Li,

That is a good idea, but can that come in later? We need to get the boot option in, so that users can decide at boot time whether they want the page_container overhead. I'll send out another set of patches to add that feature or work with Paul to see what he thinks about it.

I'm not requiring this to be done in this patch. :)

But my exact meaning here is this sentence is confusing:

See /proc/cgroups for a list of compiled controllers

It seems it is telling people that /proc/cgroups shows not only enabled but also disabled cgroup subsystems.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>