memcg: swapout refcnt fix
css's refcnt is dropped before end of following access. Hold it until end of access. Reported-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b85a96c0b6
commit
a7fe942e94
@ -1171,6 +1171,8 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
|
|||||||
mz = page_cgroup_zoneinfo(pc);
|
mz = page_cgroup_zoneinfo(pc);
|
||||||
unlock_page_cgroup(pc);
|
unlock_page_cgroup(pc);
|
||||||
|
|
||||||
|
/* at swapout, this memcg will be accessed to record to swap */
|
||||||
|
if (ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT)
|
||||||
css_put(&mem->css);
|
css_put(&mem->css);
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
@ -1212,6 +1214,8 @@ void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
|
|||||||
swap_cgroup_record(ent, memcg);
|
swap_cgroup_record(ent, memcg);
|
||||||
mem_cgroup_get(memcg);
|
mem_cgroup_get(memcg);
|
||||||
}
|
}
|
||||||
|
if (memcg)
|
||||||
|
css_put(&memcg->css);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
|
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
|
||||||
|
Loading…
Reference in New Issue
Block a user