cgroup: implement cgroup_subsys->depends_on
authorTejun Heo <tj@kernel.org>
Tue, 8 Jul 2014 22:02:57 +0000 (18:02 -0400)
committerTejun Heo <tj@kernel.org>
Tue, 8 Jul 2014 22:02:57 +0000 (18:02 -0400)
commitaf0ba6789c8e43518635606d0af1ff475ba7471a
treee191c511bc1102149d4e44b196ec96691179f67f
parentb4536f0cab2b18414e26101a2b9d484c5cbea0c0
cgroup: implement cgroup_subsys->depends_on

Currently, the blkio subsystem attributes all of writeback IOs to the
root.  One of the issues is that there's no way to tell who originated
a writeback IO from block layer.  Those IOs are usually issued
asynchronously from a task which didn't have anything to do with
actually generating the dirty pages.  The memory subsystem, when
enabled, already keeps track of the ownership of each dirty page and
it's desirable for blkio to piggyback instead of adding its own
per-page tag.

blkio piggybacking on memory is an implementation detail which
preferably should be handled automatically without requiring explicit
userland action.  To achieve that, this patch implements
cgroup_subsys->depends_on which contains the mask of subsystems which
should be enabled together when the subsystem is enabled.

The previous patches already implemented the support for enabled but
invisible subsystems and cgroup_subsys->depends_on can be easily
implemented by updating cgroup_refresh_child_subsys_mask() so that it
calculates cgroup->child_subsys_mask considering
cgroup_subsys->depends_on of the explicitly enabled subsystems.

Documentation/cgroups/unified-hierarchy.txt is updated to explain that
subsystems may not become immediately available after being unused
from userland and that dependency could be a factor in it.  As
subsystems may already keep residual references, this doesn't
significantly change how subsystem rebinding can be used.

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