aboutsummaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index 1c2a71aa05cd..20a8c2687b1e 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -616,15 +616,13 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
616 /* 616 /*
617 * Establish migration ptes or remove ptes 617 * Establish migration ptes or remove ptes
618 */ 618 */
619 if (try_to_unmap(page, 1) != SWAP_FAIL) { 619 try_to_unmap(page, 1);
620 if (!page_mapped(page)) 620 if (!page_mapped(page))
621 rc = move_to_new_page(newpage, page); 621 rc = move_to_new_page(newpage, page);
622 } else
623 /* A vma has VM_LOCKED set -> permanent failure */
624 rc = -EPERM;
625 622
626 if (rc) 623 if (rc)
627 remove_migration_ptes(page, page); 624 remove_migration_ptes(page, page);
625
628unlock: 626unlock:
629 unlock_page(page); 627 unlock_page(page);
630 628
@@ -743,7 +741,7 @@ static struct page *new_page_node(struct page *p, unsigned long private,
743 741
744 *result = &pm->status; 742 *result = &pm->status;
745 743
746 return alloc_pages_node(pm->node, GFP_HIGHUSER, 0); 744 return alloc_pages_node(pm->node, GFP_HIGHUSER | GFP_THISNODE, 0);
747} 745}
748 746
749/* 747/*
@@ -976,3 +974,23 @@ out2:
976} 974}
977#endif 975#endif
978 976
977/*
978 * Call migration functions in the vma_ops that may prepare
979 * memory in a vm for migration. migration functions may perform
980 * the migration for vmas that do not have an underlying page struct.
981 */
982int migrate_vmas(struct mm_struct *mm, const nodemask_t *to,
983 const nodemask_t *from, unsigned long flags)
984{
985 struct vm_area_struct *vma;
986 int err = 0;
987
988 for(vma = mm->mmap; vma->vm_next && !err; vma = vma->vm_next) {
989 if (vma->vm_ops && vma->vm_ops->migrate) {
990 err = vma->vm_ops->migrate(vma, to, from, flags);
991 if (err)
992 break;
993 }
994 }
995 return err;
996}