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 e9c2fb01e89b..2727f9238359 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -782,7 +782,14 @@ static int parse_cgroupfs_options(char *data, | |||
782 | if (!*token) | 782 | if (!*token) |
783 | return -EINVAL; | 783 | return -EINVAL; |
784 | if (!strcmp(token, "all")) { | 784 | if (!strcmp(token, "all")) { |
785 | opts->subsys_bits = (1 << CGROUP_SUBSYS_COUNT) - 1; | 785 | /* Add all non-disabled subsystems */ |
786 | int i; | ||
787 | opts->subsys_bits = 0; | ||
788 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | ||
789 | struct cgroup_subsys *ss = subsys[i]; | ||
790 | if (!ss->disabled) | ||
791 | opts->subsys_bits |= 1ul << i; | ||
792 | } | ||
786 | } else if (!strcmp(token, "noprefix")) { | 793 | } else if (!strcmp(token, "noprefix")) { |
787 | set_bit(ROOT_NOPREFIX, &opts->flags); | 794 | set_bit(ROOT_NOPREFIX, &opts->flags); |
788 | } else if (!strncmp(token, "release_agent=", 14)) { | 795 | } else if (!strncmp(token, "release_agent=", 14)) { |
@@ -800,7 +807,8 @@ static int parse_cgroupfs_options(char *data, | |||
800 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 807 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
801 | ss = subsys[i]; | 808 | ss = subsys[i]; |
802 | if (!strcmp(token, ss->name)) { | 809 | if (!strcmp(token, ss->name)) { |
803 | set_bit(i, &opts->subsys_bits); | 810 | if (!ss->disabled) |
811 | set_bit(i, &opts->subsys_bits); | ||
804 | break; | 812 | break; |
805 | } | 813 | } |
806 | } | 814 | } |
@@ -2082,7 +2090,7 @@ static int cgroup_tasks_open(struct inode *unused, struct file *file) | |||
2082 | 2090 | ||
2083 | kfree(pidarray); | 2091 | kfree(pidarray); |
2084 | } else { | 2092 | } else { |
2085 | ctr->buf = 0; | 2093 | ctr->buf = NULL; |
2086 | ctr->bufsz = 0; | 2094 | ctr->bufsz = 0; |
2087 | } | 2095 | } |
2088 | file->private_data = ctr; | 2096 | file->private_data = ctr; |
@@ -2561,6 +2569,7 @@ static int proc_cgroup_show(struct seq_file *m, void *v) | |||
2561 | /* Skip this hierarchy if it has no active subsystems */ | 2569 | /* Skip this hierarchy if it has no active subsystems */ |
2562 | if (!root->actual_subsys_bits) | 2570 | if (!root->actual_subsys_bits) |
2563 | continue; | 2571 | continue; |
2572 | seq_printf(m, "%lu:", root->subsys_bits); | ||
2564 | for_each_subsys(root, ss) | 2573 | for_each_subsys(root, ss) |
2565 | seq_printf(m, "%s%s", count++ ? "," : "", ss->name); | 2574 | seq_printf(m, "%s%s", count++ ? "," : "", ss->name); |
2566 | seq_putc(m, ':'); | 2575 | seq_putc(m, ':'); |
@@ -2600,13 +2609,13 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v) | |||
2600 | { | 2609 | { |
2601 | int i; | 2610 | int i; |
2602 | 2611 | ||
2603 | seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\n"); | 2612 | seq_puts(m, "#subsys_name\thierarchy\tnum_cgroups\tenabled\n"); |
2604 | mutex_lock(&cgroup_mutex); | 2613 | mutex_lock(&cgroup_mutex); |
2605 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | 2614 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { |
2606 | struct cgroup_subsys *ss = subsys[i]; | 2615 | struct cgroup_subsys *ss = subsys[i]; |
2607 | seq_printf(m, "%s\t%lu\t%d\n", | 2616 | seq_printf(m, "%s\t%lu\t%d\t%d\n", |
2608 | ss->name, ss->root->subsys_bits, | 2617 | ss->name, ss->root->subsys_bits, |
2609 | ss->root->number_of_cgroups); | 2618 | ss->root->number_of_cgroups, !ss->disabled); |
2610 | } | 2619 | } |
2611 | mutex_unlock(&cgroup_mutex); | 2620 | mutex_unlock(&cgroup_mutex); |
2612 | return 0; | 2621 | return 0; |
@@ -2614,7 +2623,7 @@ static int proc_cgroupstats_show(struct seq_file *m, void *v) | |||
2614 | 2623 | ||
2615 | static int cgroupstats_open(struct inode *inode, struct file *file) | 2624 | static int cgroupstats_open(struct inode *inode, struct file *file) |
2616 | { | 2625 | { |
2617 | return single_open(file, proc_cgroupstats_show, 0); | 2626 | return single_open(file, proc_cgroupstats_show, NULL); |
2618 | } | 2627 | } |
2619 | 2628 | ||
2620 | static struct file_operations proc_cgroupstats_operations = { | 2629 | static struct file_operations proc_cgroupstats_operations = { |
@@ -3010,3 +3019,27 @@ static void cgroup_release_agent(struct work_struct *work) | |||
3010 | spin_unlock(&release_list_lock); | 3019 | spin_unlock(&release_list_lock); |
3011 | mutex_unlock(&cgroup_mutex); | 3020 | mutex_unlock(&cgroup_mutex); |
3012 | } | 3021 | } |
3022 | |||
3023 | static int __init cgroup_disable(char *str) | ||
3024 | { | ||
3025 | int i; | ||
3026 | char *token; | ||
3027 | |||
3028 | while ((token = strsep(&str, ",")) != NULL) { | ||
3029 | if (!*token) | ||
3030 | continue; | ||
3031 | |||
3032 | for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { | ||
3033 | struct cgroup_subsys *ss = subsys[i]; | ||
3034 | |||
3035 | if (!strcmp(token, ss->name)) { | ||
3036 | ss->disabled = 1; | ||
3037 | printk(KERN_INFO "Disabling %s control group" | ||
3038 | " subsystem\n", ss->name); | ||
3039 | break; | ||
3040 | } | ||
3041 | } | ||
3042 | } | ||
3043 | return 1; | ||
3044 | } | ||
3045 | __setup("cgroup_disable=", cgroup_disable); | ||