• Tejun Heo's avatar
    cgroup: make css_for_each_descendant() and friends include the origin css in the iteration · bd8815a6
    Tejun Heo authored
    Previously, all css descendant iterators didn't include the origin
    (root of subtree) css in the iteration.  The reasons were maintaining
    consistency with css_for_each_child() and that at the time of
    introduction more use cases needed skipping the origin anyway;
    however, given that css_is_descendant() considers self to be a
    descendant, omitting the origin css has become more confusing and
    looking at the accumulated use cases rather clearly indicates that
    including origin would result in simpler code overall.
    
    While this is a change which can easily lead to subtle bugs, cgroup
    API including the iterators has recently gone through major
    restructuring and no out-of-tree changes will be applicable without
    adjustments making this a relatively acceptable opportunity for this
    type of change.
    
    The conversions are mostly straight-forward.  If the iteration block
    had explicit origin handling before or after, it's moved inside the
    iteration.  If not, if (pos == origin) continue; is added.  Some
    conversions add extra reference get/put around origin handling by
    consolidating origin handling and the rest.  While the extra ref
    operations aren't strictly necessary, this shouldn't cause any
    noticeable difference.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    Acked-by: default avatarVivek Goyal <vgoyal@redhat.com>
    Acked-by: default avatarAristeu Rozanski <aris@redhat.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Matt Helsley <matthltc@us.ibm.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Cc: Balbir Singh <bsingharora@gmail.com>
    bd8815a6
cgroup.c 155 KB