• Tejun Heo's avatar
    cgroup: introduce cgroup_control() and cgroup_ss_mask() · 5531dc91
    Tejun Heo authored
    When a controller is enabled and visible on a non-root cgroup is
    determined by subtree_control and subtree_ss_mask of the parent
    cgroup.  For a root cgroup, by the type of the hierarchy and which
    controllers are attached to it.  Deciding the above on each usage is
    fragile and unnecessarily complicates the users.
    
    This patch introduces cgroup_control() and cgroup_ss_mask() which
    calculate and return the [visibly] enabled subsyste mask for the
    specified cgroup and conver the existing usages.
    
    * cgroup_e_css() is restructured for simplicity.
    
    * cgroup_calc_subtree_ss_mask() and cgroup_subtree_control_write() no
      longer need to distinguish root and non-root cases.
    
    * With cgroup_control(), cgroup_controllers_show() can now handle both
      root and non-root cases.  cgroup_root_controllers_show() is removed.
    
    v2: cgroup_control() updated to yield the correct result on v1
        hierarchies too.  cgroup_subtree_control_write() converted.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarZefan Li <lizefan@huawei.com>
    5531dc91
cgroup.c 163 KB