aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/memcontrol.h
diff options
context:
space:
mode:
authorDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>2011-01-13 18:47:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:51 -0500
commit50de1dd967d4ba3b8a90ebe7a4f5feca24191317 (patch)
treeed2aa4352ae3c2887a90ef6279588a7048397d1b /include/linux/memcontrol.h
parent17295c88a160c6eea3fcf46cec9d08a0fcb02db9 (diff)
memcg: fix memory migration of shmem swapcache
In the current implementation mem_cgroup_end_migration() decides whether the page migration has succeeded or not by checking "oldpage->mapping". But if we are tring to migrate a shmem swapcache, the page->mapping of it is NULL from the begining, so the check would be invalid. As a result, mem_cgroup_end_migration() assumes the migration has succeeded even if it's not, so "newpage" would be freed while it's not uncharged. This patch fixes it by passing mem_cgroup_end_migration() the result of the page migration. Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Reviewed-by: Minchan Kim <minchan.kim@gmail.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Minchan Kim <minchan.kim@gmail.com> Reviewed-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/memcontrol.h')
-rw-r--r--include/linux/memcontrol.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 067115ce6b3e..6a576f989437 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -98,7 +98,7 @@ extern int
98mem_cgroup_prepare_migration(struct page *page, 98mem_cgroup_prepare_migration(struct page *page,
99 struct page *newpage, struct mem_cgroup **ptr); 99 struct page *newpage, struct mem_cgroup **ptr);
100extern void mem_cgroup_end_migration(struct mem_cgroup *mem, 100extern void mem_cgroup_end_migration(struct mem_cgroup *mem,
101 struct page *oldpage, struct page *newpage); 101 struct page *oldpage, struct page *newpage, bool migration_ok);
102 102
103/* 103/*
104 * For memory reclaim. 104 * For memory reclaim.
@@ -251,8 +251,7 @@ mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
251} 251}
252 252
253static inline void mem_cgroup_end_migration(struct mem_cgroup *mem, 253static inline void mem_cgroup_end_migration(struct mem_cgroup *mem,
254 struct page *oldpage, 254 struct page *oldpage, struct page *newpage, bool migration_ok)
255 struct page *newpage)
256{ 255{
257} 256}
258 257