blkcg, memcg: make blkcg depend on memcg on the default hierarchy
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)
commit1ced953b17bfaf54ec1499f8bbfdf31ab36453af
tree270f730f641e23ebc6827593e295f434a60a9732
parentaf0ba6789c8e43518635606d0af1ff475ba7471a
blkcg, memcg: make blkcg depend on memcg on the default hierarchy

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.

cgroup now has a mechanism to express such dependency -
cgroup_subsys->depends_on.  This patch declares that blkcg depends on
memcg so that memcg is enabled automatically on the default hierarchy
when available.  Future changes will make blkcg map the memcg tag to
find out the cgroup to blame for writeback IOs.

As this means that a memcg may be made invisible, this patch also
implements css_reset() for memcg which resets its basic
configurations.  This implementation will probably need to be expanded
to cover other states which are used in the default hierarchy.

v2: blkcg's dependency on memcg is wrapped with CONFIG_MEMCG to avoid
    build failure.  Reported by kbuild test robot.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Li Zefan <lizefan@huawei.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c
mm/memcontrol.c