• Daisuke Nishimura's avatar
    memcg: get/put parents at create/free · 7bcc1bb1
    Daisuke Nishimura authored
    The lifetime of struct cgroup and struct mem_cgroup is different and
    mem_cgroup has its own reference count for handling references from
    swap_cgroup.
    
    This causes strange problem that the parent mem_cgroup dies while child
    mem_cgroup alive, and this problem causes a bug in case of
    use_hierarchy==1 because res_counter_uncharge climbs up the tree.
    
    This patch is for avoiding it by getting the parent at create, and putting
    it at freeing.
    Signed-off-by: default avatarDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
    Reviewed-by; KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
    Cc: Pavel Emelyanov <xemul@openvz.org>
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    Cc: Paul Menage <menage@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    7bcc1bb1
memcontrol.c 56.9 KB