• J
    cgroup: prevent mount hang due to memory controller lifetime · 3c606d35
    Johannes Weiner 提交于
    Since b2052564 ("mm: memcontrol: continue cache reclaim from
    offlined groups"), re-mounting the memory controller after using it is
    very likely to hang.
    
    The cgroup core assumes that any remaining references after deleting a
    cgroup are temporary in nature, and synchroneously waits for them, but
    the above-mentioned commit has left-over page cache pin its css until
    it is reclaimed naturally.  That being said, swap entries and charged
    kernel memory have been doing the same indefinite pinning forever, the
    bug is just more likely to trigger with left-over page cache.
    
    Reparenting kernel memory is highly impractical, which leaves changing
    the cgroup assumptions to reflect this: once a controller has been
    mounted and used, it has internal state that is independent from mount
    and cgroup lifetime.  It can be unmounted and remounted, but it can't
    be reconfigured during subsequent mounts.
    
    Don't offline the controller root as long as there are any children,
    dead or alive.  A remount will no longer wait for these old references
    to drain, it will simply mount the persistent controller state again.
    Reported-by: N"Suzuki K. Poulose" <Suzuki.Poulose@arm.com>
    Reported-by: NWill Deacon <will.deacon@arm.com>
    Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
    Signed-off-by: NTejun Heo <tj@kernel.org>
    3c606d35
cgroup.c 149.9 KB