• Glauber Costa's avatar
    memcg: fast hierarchy-aware child test · b5f99b53
    Glauber Costa authored
    Currently, we use cgroups' provided list of children to verify if it is
    safe to proceed with any value change that is dependent on the cgroup
    being empty.
    
    This is less than ideal, because it enforces a dependency over cgroup
    core that we would be better off without.  The solution proposed here is
    to iterate over the child cgroups and if any is found that is already
    online, we bounce and return: we don't really care how many children we
    have, only if we have any.
    
    This is also made to be hierarchy aware.  IOW, cgroups with hierarchy
    disabled, while they still exist, will be considered for the purpose of
    this interface as having no children.
    
    [akpm@linux-foundation.org: tweak comments]
    Signed-off-by: default avatarGlauber Costa <glommer@parallels.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Hiroyuki Kamezawa <kamezawa.hiroyuki@gmail.com>
    Cc: Johannes Weiner <hannes@cmpxchg.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    b5f99b53
memcontrol.c 181 KB