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 <[email protected]>
---
 mm/migrate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
-- 
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to