• T
    cgroup: introduce sane_behavior mount option · 873fe09e
    Tejun Heo 提交于
    It's a sad fact that at this point various cgroup controllers are
    carrying so many idiosyncrasies and pure insanities that it simply
    isn't possible to reach any sort of sane consistent behavior while
    maintaining staying fully compatible with what already has been
    exposed to userland.
    
    As we can't break exposed userland interface, transitioning to sane
    behaviors can only be done in steps while maintaining backwards
    compatibility.  This patch introduces a new mount option -
    __DEVEL__sane_behavior - which disables crazy features and enforces
    consistent behaviors in cgroup core proper and various controllers.
    As exactly which behaviors it changes are still being determined, the
    mount option, at this point, is useful only for development of the new
    behaviors.  As such, the mount option is prefixed with __DEVEL__ and
    generates a warning message when used.
    
    Eventually, once we get to the point where all controller's behaviors
    are consistent enough to implement unified hierarchy, the __DEVEL__
    prefix will be dropped, and more importantly, unified-hierarchy will
    enforce sane_behavior by default.  Maybe we'll able to completely drop
    the crazy stuff after a while, maybe not, but we at least have a
    strategy to move on to saner behaviors.
    
    This patch introduces the mount option and changes the following
    behaviors in cgroup core.
    
    * Mount options "noprefix" and "clone_children" are disallowed.  Also,
      cgroupfs file cgroup.clone_children is not created.
    
    * When mounting an existing superblock, mount options should match.
      This is currently pretty crazy.  If one mounts a cgroup, creates a
      subdirectory, unmounts it and then mount it again with different
      option, it looks like the new options are applied but they aren't.
    
    * Remount is disallowed.
    
    The behaviors changes are documented in the comment above
    CGRP_ROOT_SANE_BEHAVIOR enum and will be expanded as different
    controllers are converted and planned improvements progress.
    
    v2: Dropped unnecessary explicit file permission setting sane_behavior
        cftype entry as suggested by Li Zefan.
    Signed-off-by: NTejun Heo <tj@kernel.org>
    Acked-by: NSerge E. Hallyn <serge.hallyn@ubuntu.com>
    Acked-by: NLi Zefan <lizefan@huawei.com>
    Cc: Michal Hocko <mhocko@suse.cz>
    Cc: Vivek Goyal <vgoyal@redhat.com>
    873fe09e
cgroup.h 26.2 KB