• Tejun Heo's avatar
    blkcg, memcg: make blkcg depend on memcg on the default hierarchy · 1ced953b
    Tejun Heo authored
    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: default avatarTejun Heo <tj@kernel.org>
    Acked-by: default avatarLi Zefan <lizefan@huawei.com>
    Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
    Cc: Michal Hocko <mhocko@suse.cz>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    Cc: Jens Axboe <axboe@kernel.dk>
    1ced953b
memcontrol.c 187 KB