mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and...
[cascardo/linux.git] / kernel / cgroup.c
index 8673843..f1603c1 100644 (file)
@@ -173,12 +173,6 @@ EXPORT_SYMBOL_GPL(cgrp_dfl_root);
  */
 static bool cgrp_dfl_root_visible;
 
-/*
- * Set by the boot param of the same name and makes subsystems with NULL
- * ->dfl_files to use ->legacy_files on the default hierarchy.
- */
-static bool cgroup_legacy_files_on_dfl;
-
 /* some controllers are not supported in the default hierarchy */
 static unsigned long cgrp_dfl_root_inhibit_ss_mask;
 
@@ -305,7 +299,7 @@ static int cgroup_idr_alloc(struct idr *idr, void *ptr, int start, int end,
 
        idr_preload(gfp_mask);
        spin_lock_bh(&cgroup_idr_lock);
-       ret = idr_alloc(idr, ptr, start, end, gfp_mask & ~__GFP_WAIT);
+       ret = idr_alloc(idr, ptr, start, end, gfp_mask & ~__GFP_DIRECT_RECLAIM);
        spin_unlock_bh(&cgroup_idr_lock);
        idr_preload_end();
        return ret;
@@ -3553,17 +3547,8 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
 {
        struct cftype *cft;
 
-       /*
-        * If legacy_flies_on_dfl, we want to show the legacy files on the
-        * dfl hierarchy but iff the target subsystem hasn't been updated
-        * for the dfl hierarchy yet.
-        */
-       if (!cgroup_legacy_files_on_dfl ||
-           ss->dfl_cftypes != ss->legacy_cftypes) {
-               for (cft = cfts; cft && cft->name[0] != '\0'; cft++)
-                       cft->flags |= __CFTYPE_NOT_ON_DFL;
-       }
-
+       for (cft = cfts; cft && cft->name[0] != '\0'; cft++)
+               cft->flags |= __CFTYPE_NOT_ON_DFL;
        return cgroup_add_cftypes(ss, cfts);
 }
 
@@ -3945,18 +3930,19 @@ void css_task_iter_start(struct cgroup_subsys_state *css,
  */
 struct task_struct *css_task_iter_next(struct css_task_iter *it)
 {
-       if (!it->cset_pos)
-               return NULL;
-
-       if (it->cur_task)
+       if (it->cur_task) {
                put_task_struct(it->cur_task);
+               it->cur_task = NULL;
+       }
 
        spin_lock_bh(&css_set_lock);
 
-       it->cur_task = list_entry(it->task_pos, struct task_struct, cg_list);
-       get_task_struct(it->cur_task);
-
-       css_task_iter_advance(it);
+       if (it->task_pos) {
+               it->cur_task = list_entry(it->task_pos, struct task_struct,
+                                         cg_list);
+               get_task_struct(it->cur_task);
+               css_task_iter_advance(it);
+       }
 
        spin_unlock_bh(&css_set_lock);
 
@@ -5242,7 +5228,7 @@ int __init cgroup_init(void)
 {
        struct cgroup_subsys *ss;
        unsigned long key;
-       int ssid, err;
+       int ssid;
 
        BUG_ON(percpu_init_rwsem(&cgroup_threadgroup_rwsem));
        BUG_ON(cgroup_init_cftypes(NULL, cgroup_dfl_base_files));
@@ -5287,9 +5273,6 @@ int __init cgroup_init(void)
 
                cgrp_dfl_root.subsys_mask |= 1 << ss->id;
 
-               if (cgroup_legacy_files_on_dfl && !ss->dfl_cftypes)
-                       ss->dfl_cftypes = ss->legacy_cftypes;
-
                if (!ss->dfl_cftypes)
                        cgrp_dfl_root_inhibit_ss_mask |= 1 << ss->id;
 
@@ -5304,17 +5287,10 @@ int __init cgroup_init(void)
                        ss->bind(init_css_set.subsys[ssid]);
        }
 
-       err = sysfs_create_mount_point(fs_kobj, "cgroup");
-       if (err)
-               return err;
+       WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup"));
+       WARN_ON(register_filesystem(&cgroup_fs_type));
+       WARN_ON(!proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations));
 
-       err = register_filesystem(&cgroup_fs_type);
-       if (err < 0) {
-               sysfs_remove_mount_point(fs_kobj, "cgroup");
-               return err;
-       }
-
-       proc_create("cgroups", 0, NULL, &proc_cgroupstats_operations);
        return 0;
 }
 
@@ -5736,14 +5712,6 @@ static int __init cgroup_disable(char *str)
 }
 __setup("cgroup_disable=", cgroup_disable);
 
-static int __init cgroup_set_legacy_files_on_dfl(char *str)
-{
-       printk("cgroup: using legacy files on the default hierarchy\n");
-       cgroup_legacy_files_on_dfl = true;
-       return 0;
-}
-__setup("cgroup__DEVEL__legacy_files_on_dfl", cgroup_set_legacy_files_on_dfl);
-
 /**
  * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
  * @dentry: directory dentry of interest