Messages in this thread Patch in this message | | | Date | Wed, 3 Dec 2008 13:52:49 +0900 | From | KAMEZAWA Hiroyuki <> | Subject | [PATCH 4/21] memcg-swapout-refcnt-fix.patch |
| |
Fix for memcg-memswap-controller-core.patch
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>
mm/memcontrol.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Index: mmotm-2.6.28-Dec01-2/mm/memcontrol.c =================================================================== --- mmotm-2.6.28-Dec01-2.orig/mm/memcontrol.c +++ mmotm-2.6.28-Dec01-2/mm/memcontrol.c @@ -1171,7 +1171,9 @@ __mem_cgroup_uncharge_common(struct page mz = page_cgroup_zoneinfo(pc); unlock_page_cgroup(pc); - css_put(&mem->css); + /* at swapout, this memcg will be accessed to record to swap */ + if (ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT) + css_put(&mem->css); return mem; @@ -1212,6 +1214,8 @@ void mem_cgroup_uncharge_swapcache(struc swap_cgroup_record(ent, memcg); mem_cgroup_get(memcg); } + if (memcg) + css_put(&memcg->css); } #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
| |