summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2014-08-08 11:44:03 -0400
committerTejun Heo <tj@kernel.org>2014-08-22 13:20:40 -0400
commitfa8137be6ba632041e725e4623258ba27a2cf9be (patch)
tree32e4be27a8840f6fbfc0f91f59d4e48ee4e91a51 /kernel
parent71b1fb5c4473a5b1e601d41b109bdfe001ec82e0 (diff)
downloadop-kernel-dev-fa8137be6ba632041e725e4623258ba27a2cf9be.zip
op-kernel-dev-fa8137be6ba632041e725e4623258ba27a2cf9be.tar.gz
cgroup: Display legacy cgroup files on default hierarchy
Kernel command line parameter cgroup__DEVEL__legacy_files_on_dfl forces legacy cgroup files to show up on default hierarhcy if susbsystem does not have any files defined for default hierarchy. But this seems to be working only if legacy files are defined in ss->legacy_cftypes. If one adds some cftypes later using cgroup_add_legacy_cftypes(), these files don't show up on default hierarchy. Update the function accordingly so that the dynamically added legacy files also show up in the default hierarchy if the target subsystem is also using the base legacy files for the default hierarchy. tj: Patch description and comment updates. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index c3d1802..50b9411 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3271,8 +3271,17 @@ int cgroup_add_legacy_cftypes(struct cgroup_subsys *ss, struct cftype *cfts)
{
struct cftype *cft;
- for (cft = cfts; cft && cft->name[0] != '\0'; cft++)
- cft->flags |= __CFTYPE_NOT_ON_DFL;
+ /*
+ * 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;
+ }
+
return cgroup_add_cftypes(ss, cfts);
}
OpenPOWER on IntegriCloud