aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2009-01-07 21:08:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:07 -0500
commita7fe942e94b2f66aa0f11d37699c0ec8155d3ad1 (patch)
tree27525266a70f8bd9aadc45695ed8db220eaf2e9a /mm/memcontrol.c
parentb85a96c0b6cb79c67e7b01b66368f2e31579d7c5 (diff)
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>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6ad309e9825f..964a70035e8f 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1171,7 +1171,9 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
1171 mz = page_cgroup_zoneinfo(pc); 1171 mz = page_cgroup_zoneinfo(pc);
1172 unlock_page_cgroup(pc); 1172 unlock_page_cgroup(pc);
1173 1173
1174 css_put(&mem->css); 1174 /* at swapout, this memcg will be accessed to record to swap */
1175 if (ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT)
1176 css_put(&mem->css);
1175 1177
1176 return mem; 1178 return mem;
1177 1179
@@ -1212,6 +1214,8 @@ void mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
1212 swap_cgroup_record(ent, memcg); 1214 swap_cgroup_record(ent, memcg);
1213 mem_cgroup_get(memcg); 1215 mem_cgroup_get(memcg);
1214 } 1216 }
1217 if (memcg)
1218 css_put(&memcg->css);
1215} 1219}
1216 1220
1217#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 1221#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP