diff options
Diffstat (limited to 'kernel/cgroup.c')
| -rw-r--r-- | kernel/cgroup.c | 47 | 
1 files changed, 40 insertions, 7 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index e9c2fb01e89..2727f923835 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *data,  		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 *data,  			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;  				}  			} @@ -2082,7 +2090,7 @@ static int cgroup_tasks_open(struct inode *unused, struct file *file)  		kfree(pidarray);  	} else { -		ctr->buf = 0; +		ctr->buf = NULL;  		ctr->bufsz = 0;  	}  	file->private_data = ctr; @@ -2561,6 +2569,7 @@ static int proc_cgroup_show(struct seq_file *m, void *v)  		/* Skip this hierarchy if it has no active subsystems */  		if (!root->actual_subsys_bits)  			continue; +		seq_printf(m, "%lu:", root->subsys_bits);  		for_each_subsys(root, ss)  			seq_printf(m, "%s%s", count++ ? "," : "", ss->name);  		seq_putc(m, ':'); @@ -2600,13 +2609,13 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)  {  	int i; -	seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\n"); +	seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n");  	mutex_lock(&cgroup_mutex);  	for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {  		struct cgroup_subsys *ss = subsys[i]; -		seq_printf(m, "%s\t%lu\t%d\n", +		seq_printf(m, "%s\t%lu\t%d\t%d\n",  			   ss->name, ss->root->subsys_bits, -			   ss->root->number_of_cgroups); +			   ss->root->number_of_cgroups, !ss->disabled);  	}  	mutex_unlock(&cgroup_mutex);  	return 0; @@ -2614,7 +2623,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v)  static int cgroupstats_open(struct inode *inode, struct file *file)  { -	return single_open(file, proc_cgroupstats_show, 0); +	return single_open(file, proc_cgroupstats_show, NULL);  }  static struct file_operations proc_cgroupstats_operations = { @@ -3010,3 +3019,27 @@ static void cgroup_release_agent(struct work_struct *work)  	spin_unlock(&release_list_lock);  	mutex_unlock(&cgroup_mutex);  } + +static int __init cgroup_disable(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 = 1; +				printk(KERN_INFO "Disabling %s control group" +					" subsystem\n", ss->name); +				break; +			} +		} +	} +	return 1; +} +__setup("cgroup_disable=", cgroup_disable);  |