cgroup: decouple cgroup_subsys_state destruction from cgroup destruction
authorTejun Heo <tj@kernel.org>
Wed, 14 Aug 2013 00:22:50 +0000 (20:22 -0400)
committerTejun Heo <tj@kernel.org>
Wed, 14 Aug 2013 00:22:50 +0000 (20:22 -0400)
commit09a503ea3a816b285b0b402b7f785eaec0c7a7e1
tree67f3a360c2e8e0851825cf3e1675bd5244d15926
parentf20104de55a212a9742d8df1807f1f29dc95b748
cgroup: decouple cgroup_subsys_state destruction from cgroup destruction

Currently, css (cgroup_subsys_state) lifetime is tied to that of the
associated cgroup.  css's are created when the associated cgroup is
created and destroyed when it gets destroyed.  Also, individual css's
aren't RCU protected but the whole cgroup is.  With the planned
unified hierarchy, css's will need to be dynamically created and
destroyed within the lifetime of a cgroup.

To enable such usages, this patch decouples css destruction from
cgroup destruction - offline_css() invocation and the final css_put()
are moved from cgroup_destroy_css_killed() to css_killed_work_fn().
Now each css is individually offlined and put as its reference count
is killed instead of waiting for all css's attached to the cgroup to
finish refcnt killing and then proceeding to offlining and putting
them together.

While this changes the order of destruction operations, the changes
shouldn't be noticeable to cgroup subsystems or userland.

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