]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/cgroup.c
x86: clean up the page table dumper and add 32-bit support
[linux-2.6-omap-h63xx.git] / kernel / cgroup.c
index 36066d8a4911e353905ad2ec52d8d29b0bff9dc9..2727f92383596e4a6f7bec5072b1e804a7801916 100644 (file)
@@ -319,7 +319,7 @@ static struct css_set *find_existing_css_set(
        /* Built the set of subsystem state objects that we want to
         * see in the new css_set */
        for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
-               if (root->subsys_bits & (1ull << i)) {
+               if (root->subsys_bits & (1UL << i)) {
                        /* Subsystem is in this hierarchy. So we want
                         * the subsystem state from the new
                         * cgroup */
@@ -470,7 +470,6 @@ static struct css_set *find_css_set(
        /* Link this cgroup group into the list */
        list_add(&res->list, &init_css_set.list);
        css_set_count++;
-       INIT_LIST_HEAD(&res->tasks);
        write_unlock(&css_set_lock);
 
        return res;
@@ -689,7 +688,7 @@ static int rebind_subsystems(struct cgroupfs_root *root,
        added_bits = final_bits & ~root->actual_subsys_bits;
        /* Check that any added subsystems are currently free */
        for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
-               unsigned long long bit = 1ull << i;
+               unsigned long bit = 1UL << i;
                struct cgroup_subsys *ss = subsys[i];
                if (!(bit & added_bits))
                        continue;
@@ -783,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)) {
@@ -801,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;
                                }
                        }
@@ -920,7 +927,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
        if (!inode)
                return -ENOMEM;
 
-       inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;
        inode->i_op = &cgroup_dir_inode_operations;
        /* directories start off with i_nlink == 2 (for "." entry) */
@@ -954,8 +960,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
        }
 
        root = kzalloc(sizeof(*root), GFP_KERNEL);
-       if (!root)
+       if (!root) {
+               if (opts.release_agent)
+                       kfree(opts.release_agent);
                return -ENOMEM;
+       }
 
        init_cgroup_root(root);
        root->subsys_bits = opts.subsys_bits;
@@ -2081,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;
@@ -2231,7 +2240,6 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
 
        mutex_lock(&cgroup_mutex);
 
-       cgrp->flags = 0;
        INIT_LIST_HEAD(&cgrp->sibling);
        INIT_LIST_HEAD(&cgrp->children);
        INIT_LIST_HEAD(&cgrp->css_sets);
@@ -2241,6 +2249,9 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
        cgrp->root = parent->root;
        cgrp->top_cgroup = parent->top_cgroup;
 
+       if (notify_on_release(parent))
+               set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags);
+
        for_each_subsys(root, ss) {
                struct cgroup_subsys_state *css = ss->create(ss, cgrp);
                if (IS_ERR(css)) {
@@ -2558,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, ':');
@@ -2597,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;
@@ -2611,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 = {
@@ -3007,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);