]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup: make cgroup_drain_offline() and cgroup_apply_control_{disable|enable}() recursive
authorTejun Heo <tj@kernel.org>
Thu, 3 Mar 2016 14:57:59 +0000 (09:57 -0500)
committerTejun Heo <tj@kernel.org>
Thu, 3 Mar 2016 14:57:59 +0000 (09:57 -0500)
commit8d349563d85776f8f7b00501533f15584e74ba87
tree4c4693697c3d07537ec53f8afe4b4e4d1aaa2179
parent8647d8b409e8b640ae2dd612a469090548af7a1a
cgroup: make cgroup_drain_offline() and cgroup_apply_control_{disable|enable}() recursive

The three factored out css management operations -
cgroup_drain_offline() and cgroup_apply_control_{disable|enable}() -
only depend on the current state of the target cgroups and idempotent
and thus can be easily made to operate on the subtree instead of the
immediate children.

This patch introduces the iterators which walk live subtree and
converts the three functions to operate on the subtree including self
instead of the children.  While this leads to spurious walking and be
slightly more expensive, it will allow them to be used for wider scope
of operations.

Note that cgroup_drain_offline() now tests for whether a css is dying
before trying to drain it.  This is to avoid trying to drain live
csses as there can be mix of live and dying csses in a subtree unlike
children of the same parent.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Zefan Li <lizefan@huawei.com>
kernel/cgroup.c