• Hugh Dickins's avatar
    memcg: css_put after remove_list · 6d48ff8b
    Hugh Dickins authored
    mem_cgroup_uncharge_page does css_put on the mem_cgroup before uncharging from
    it, and before removing page_cgroup from one of its lru lists: isn't there a
    danger that struct mem_cgroup memory could be freed and reused before
    completing that, so corrupting something?  Never seen it, and for all I know
    there may be other constraints which make it impossible; but let's be
    defensive and reverse the ordering there.
    
    mem_cgroup_force_empty_list is safe because there's an extra css_get around
    all its works; but even so, change its ordering the same way round, to help
    get in the habit of doing it like this.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Cc: David Rientjes <rientjes@google.com>
    Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
    Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: Hirokazu Takahashi <taka@valinux.co.jp>
    Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
    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>
    6d48ff8b
memcontrol.c 26.9 KB