]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: iterate cgroup_subsys_states directly
authorTejun Heo <tj@kernel.org>
Fri, 16 May 2014 17:22:51 +0000 (13:22 -0400)
committerTejun Heo <tj@kernel.org>
Fri, 16 May 2014 17:22:51 +0000 (13:22 -0400)
commit3799214800f271e1df288702de3abe454fc1dfcb
tree0a530060fd1b196eda8e2ff81bd4010bd559ff12
parent6d47bd7f0e240ffd7d119e7ba23d82867cf81c4e
cgroup: iterate cgroup_subsys_states directly

Currently, css_next_child() is implemented as finding the next child
cgroup which has the css enabled, which used to be the only way to do
it as only cgroups participated in sibling lists and thus could be
iteratd.  This works as long as what's required during iteration is
not missing online csses; however, it turns out that there are use
cases where offlined but not yet released csses need to be iterated.
This is difficult to implement through cgroup iteration the unified
hierarchy as there may be multiple dying csses for the same subsystem
associated with single cgroup.

After the recent changes, the cgroup self and regular csses behave
identically in how they're linked and unlinked from the sibling lists
including assertion of CSS_RELEASED and css_next_child() can simply
switch to iterating csses directly.  This both simplifies the logic
and ensures that all visible non-released csses are included in the
iteration whether there are multiple dying csses for a subsystem or
not.

As all other iterators depend on css_next_child() for sibling
iteration, this changes behaviors of all css iterators.  Add and
update explanations on the css states which are included in traversal
to all iterators.

As css iteration could always contain offlined csses, this shouldn't
break any of the current users and new usages which need iteration of
all on and offline csses can make use of the new semantics.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
include/linux/cgroup.h
kernel/cgroup.c