summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2014-07-17 10:57:53 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-07-17 10:57:53 +1000
commitabf8f441f7bb7ec0edc8f2c706aa71171640d143 (patch)
tree736c1fd5a63f0126302c8078ad0fcf07d9b5336d
parentd071aed73c6a44fcd3647079e2e8780accf40318 (diff)
mm: memcontrol: rewrite uncharge API fix - migrate before re-mapping
Mapped file accounting depends on the the page being charged already, or it won't get accounted properly, and the mapped file counter will underflow during unmap later on. Move mem_cgroup_migrate() before remove_migration_ptes(). Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/migrate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index ab43fbfff8ba..7f5a42403fae 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -781,11 +781,11 @@ static int move_to_new_page(struct page *newpage, struct page *page,
if (!PageAnon(newpage))
newpage->mapping = NULL;
} else {
+ mem_cgroup_migrate(page, newpage, false);
if (remap_swapcache)
remove_migration_ptes(page, newpage);
if (!PageAnon(page))
page->mapping = NULL;
- mem_cgroup_migrate(page, newpage, false);
}
unlock_page(newpage);