Skip to content

Commit

Permalink
mm: migrate: consolidate mem_cgroup_migrate() calls
Browse files Browse the repository at this point in the history
Rather than scattering mem_cgroup_migrate() calls all over the place,
have a single call from a safe place where every migration operation
eventually ends up in - migrate_page_copy().

Signed-off-by: Johannes Weiner <[email protected]>
Suggested-by: Hugh Dickins <[email protected]>
Acked-by: Vladimir Davydov <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Mateusz Guzik <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hnaz authored and torvalds committed Mar 15, 2016
1 parent 7cf91a9 commit 74485cf
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,6 @@ int migrate_page_move_mapping(struct address_space *mapping,
if (PageSwapBacked(page))
SetPageSwapBacked(newpage);

mem_cgroup_migrate(page, newpage);

return MIGRATEPAGE_SUCCESS;
}

Expand Down Expand Up @@ -428,8 +426,6 @@ int migrate_page_move_mapping(struct address_space *mapping,
}
local_irq_enable();

mem_cgroup_migrate(page, newpage);

return MIGRATEPAGE_SUCCESS;
}

Expand Down Expand Up @@ -471,8 +467,6 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,

spin_unlock_irq(&mapping->tree_lock);

mem_cgroup_migrate(page, newpage);

return MIGRATEPAGE_SUCCESS;
}

Expand Down Expand Up @@ -586,6 +580,8 @@ void migrate_page_copy(struct page *newpage, struct page *page)
end_page_writeback(newpage);

copy_page_owner(page, newpage);

mem_cgroup_migrate(page, newpage);
}

/************************************************************
Expand Down Expand Up @@ -1846,7 +1842,6 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm,
}

mlock_migrate_page(new_page, page);
mem_cgroup_migrate(page, new_page);
page_remove_rmap(page, true);
set_page_owner_migrate_reason(new_page, MR_NUMA_MISPLACED);

Expand Down

0 comments on commit 74485cf

Please sign in to comment.