cgroup: don't print subsystems for the default hierarchy
authorTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 20:58:16 +0000 (13:58 -0700)
committerTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 20:58:16 +0000 (13:58 -0700)
It doesn't make sense to print subsystems on mount option or
/proc/PID/cgroup for the default hierarchy.

* cgroup.controllers file at the root of the default hierarchy lists
  the currently attached controllers.

* The default hierarchy is catch-all for unmounted subsystems.

* The default hierarchy doesn't accept any mount options.

Suppress subsystem printing on mount options and /proc/PID/cgroup for
the default hierarchy.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: cgroups@vger.kernel.org
kernel/cgroup.c

index 3f6641632f731ae4ddc9cd731a0905c99057895a..d9f854defa784e3710b80addc5bf81d490bc2ff0 100644 (file)
@@ -1333,9 +1333,10 @@ static int cgroup_show_options(struct seq_file *seq,
        struct cgroup_subsys *ss;
        int ssid;
 
-       for_each_subsys(ss, ssid)
-               if (root->subsys_mask & (1 << ssid))
-                       seq_printf(seq, ",%s", ss->name);
+       if (root != &cgrp_dfl_root)
+               for_each_subsys(ss, ssid)
+                       if (root->subsys_mask & (1 << ssid))
+                               seq_printf(seq, ",%s", ss->name);
        if (root->flags & CGRP_ROOT_NOPREFIX)
                seq_puts(seq, ",noprefix");
        if (root->flags & CGRP_ROOT_XATTR)
@@ -5137,9 +5138,11 @@ int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
                        continue;
 
                seq_printf(m, "%d:", root->hierarchy_id);
-               for_each_subsys(ss, ssid)
-                       if (root->subsys_mask & (1 << ssid))
-                               seq_printf(m, "%s%s", count++ ? "," : "", ss->name);
+               if (root != &cgrp_dfl_root)
+                       for_each_subsys(ss, ssid)
+                               if (root->subsys_mask & (1 << ssid))
+                                       seq_printf(m, "%s%s", count++ ? "," : "",
+                                                  ss->name);
                if (strlen(root->name))
                        seq_printf(m, "%sname=%s", count ? "," : "",
                                   root->name);