When we create a cgroup in unified hierarchy, we have to enable
controllers in cgrp_dfl_root.subtree_control manually. From
my practice, I did not find the benefit we disable controllers
in cgrp_dfl_root by default.

As I am a newbie to cgroup, please correct me if I am wrong.

Thanx.

Signed-off-by: Dongsheng Yang <[email protected]>
---
 kernel/cgroup.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 7dc8788..70996ee 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1267,12 +1267,9 @@ static int rebind_subsystems(struct cgroup_root 
*dst_root, unsigned int ss_mask)
                src_root->cgrp.subtree_control &= ~(1 << ssid);
                cgroup_refresh_child_subsys_mask(&src_root->cgrp);
 
-               /* default hierarchy doesn't enable controllers by default */
                dst_root->subsys_mask |= 1 << ssid;
-               if (dst_root != &cgrp_dfl_root) {
-                       dst_root->cgrp.subtree_control |= 1 << ssid;
-                       cgroup_refresh_child_subsys_mask(&dst_root->cgrp);
-               }
+               dst_root->cgrp.subtree_control |= 1 << ssid;
+               cgroup_refresh_child_subsys_mask(&dst_root->cgrp);
 
                if (ss->bind)
                        ss->bind(css);
@@ -4990,6 +4987,8 @@ int __init cgroup_init(void)
                }
        }
 
+       cgrp_dfl_root.cgrp.subtree_control = cgrp_dfl_root.subsys_mask;
+
        cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
        if (!cgroup_kobj)
                return -ENOMEM;
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to