• Tejun Heo's avatar
    cgroup: introduce effective cgroup_subsys_state · aec3dfcb
    Tejun Heo authored
    In the planned default unified hierarchy, controllers may get
    dynamically attached to and detached from a cgroup and a cgroup may
    not have csses for all the controllers associated with the hierarchy.
    
    When a cgroup doesn't have its own css for a given controller, the css
    of the nearest ancestor with the controller enabled will be used,
    which is called the effective css.  This patch introduces
    cgroup_e_css() and for_each_e_css() to access the effective csses and
    convert compare_css_sets(), find_existing_css_set() and
    cgroup_migrate() to use the effective csses so that they can handle
    cgroups with partial csses correctly.
    
    This means that for two css_sets to be considered identical, they
    should have both matching csses and cgroups.  compare_css_sets()
    already compares both, not for correctness but for optimization.  As
    this now becomes a matter of correctness, update the comments
    accordingly.
    
    For all !default hierarchies, cgroup_e_css() always equals
    cgroup_css(), so this patch doesn't change behavior.
    
    While at it, fix incorrect locking comment for for_each_css().
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    aec3dfcb
cgroup.c 131 KB