aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorMel Gorman <mgorman@suse.de>2012-11-19 07:35:47 -0500
committerMel Gorman <mgorman@suse.de>2012-12-11 09:42:57 -0500
commitb32967ff101a7508f70be8de59b278d4df92fa00 (patch)
treeb106d5eea06f97d0174f483d6a05a8b7ddd64154 /mm/memcontrol.c
parent5bca23035391928c4c7301835accca3551b96cc2 (diff)
mm: numa: Add THP migration for the NUMA working set scanning fault case.
Note: This is very heavily based on a patch from Peter Zijlstra with fixes from Ingo Molnar, Hugh Dickins and Johannes Weiner. That patch put a lot of migration logic into mm/huge_memory.c where it does not belong. This version puts tries to share some of the migration logic with migrate_misplaced_page. However, it should be noted that now migrate.c is doing more with the pagetable manipulation than is preferred. The end result is barely recognisable so as before, the signed-offs had to be removed but will be re-added if the original authors are ok with it. Add THP migration for the NUMA working set scanning fault case. It uses the page lock to serialize. No migration pte dance is necessary because the pte is already unmapped when we decide to migrate. [dhillf@gmail.com: Fix memory leak on isolation failure] [dhillf@gmail.com: Fix transfer of last_nid information] Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index dd39ba000b31..d97af9636ab2 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3288,15 +3288,18 @@ void mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
3288 struct mem_cgroup **memcgp) 3288 struct mem_cgroup **memcgp)
3289{ 3289{
3290 struct mem_cgroup *memcg = NULL; 3290 struct mem_cgroup *memcg = NULL;
3291 unsigned int nr_pages = 1;
3291 struct page_cgroup *pc; 3292 struct page_cgroup *pc;
3292 enum charge_type ctype; 3293 enum charge_type ctype;
3293 3294
3294 *memcgp = NULL; 3295 *memcgp = NULL;
3295 3296
3296 VM_BUG_ON(PageTransHuge(page));
3297 if (mem_cgroup_disabled()) 3297 if (mem_cgroup_disabled())
3298 return; 3298 return;
3299 3299
3300 if (PageTransHuge(page))
3301 nr_pages <<= compound_order(page);
3302
3300 pc = lookup_page_cgroup(page); 3303 pc = lookup_page_cgroup(page);
3301 lock_page_cgroup(pc); 3304 lock_page_cgroup(pc);
3302 if (PageCgroupUsed(pc)) { 3305 if (PageCgroupUsed(pc)) {
@@ -3358,7 +3361,7 @@ void mem_cgroup_prepare_migration(struct page *page, struct page *newpage,
3358 * charged to the res_counter since we plan on replacing the 3361 * charged to the res_counter since we plan on replacing the
3359 * old one and only one page is going to be left afterwards. 3362 * old one and only one page is going to be left afterwards.
3360 */ 3363 */
3361 __mem_cgroup_commit_charge(memcg, newpage, 1, ctype, false); 3364 __mem_cgroup_commit_charge(memcg, newpage, nr_pages, ctype, false);
3362} 3365}
3363 3366
3364/* remove redundant charge if migration failed*/ 3367/* remove redundant charge if migration failed*/