aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-03-03 06:27:25 -0500
committerSteve French <sfrench@us.ibm.com>2006-03-03 06:27:25 -0500
commitc6ee60b7c8bbc78e3b1776b2820a7e7f95f8996a (patch)
tree99b48ef0f5217fddc0aa897d9e60d95ace7da6ff /mm/mempolicy.c
parent13298defe5323c7fdcac268f588d8d1090758fb8 (diff)
parentc499ec24c31edf270e777a868ffd0daddcfe7ebd (diff)
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 880831bd3003..1a210088ad80 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -552,7 +552,7 @@ static void migrate_page_add(struct page *page, struct list_head *pagelist,
552 */ 552 */
553 if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) { 553 if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) {
554 if (isolate_lru_page(page)) 554 if (isolate_lru_page(page))
555 list_add(&page->lru, pagelist); 555 list_add_tail(&page->lru, pagelist);
556 } 556 }
557} 557}
558 558
@@ -569,6 +569,7 @@ static int migrate_pages_to(struct list_head *pagelist,
569 LIST_HEAD(moved); 569 LIST_HEAD(moved);
570 LIST_HEAD(failed); 570 LIST_HEAD(failed);
571 int err = 0; 571 int err = 0;
572 unsigned long offset = 0;
572 int nr_pages; 573 int nr_pages;
573 struct page *page; 574 struct page *page;
574 struct list_head *p; 575 struct list_head *p;
@@ -576,8 +577,21 @@ static int migrate_pages_to(struct list_head *pagelist,
576redo: 577redo:
577 nr_pages = 0; 578 nr_pages = 0;
578 list_for_each(p, pagelist) { 579 list_for_each(p, pagelist) {
579 if (vma) 580 if (vma) {
580 page = alloc_page_vma(GFP_HIGHUSER, vma, vma->vm_start); 581 /*
582 * The address passed to alloc_page_vma is used to
583 * generate the proper interleave behavior. We fake
584 * the address here by an increasing offset in order
585 * to get the proper distribution of pages.
586 *
587 * No decision has been made as to which page
588 * a certain old page is moved to so we cannot
589 * specify the correct address.
590 */
591 page = alloc_page_vma(GFP_HIGHUSER, vma,
592 offset + vma->vm_start);
593 offset += PAGE_SIZE;
594 }
581 else 595 else
582 page = alloc_pages_node(dest, GFP_HIGHUSER, 0); 596 page = alloc_pages_node(dest, GFP_HIGHUSER, 0);
583 597
@@ -585,7 +599,7 @@ redo:
585 err = -ENOMEM; 599 err = -ENOMEM;
586 goto out; 600 goto out;
587 } 601 }
588 list_add(&page->lru, &newlist); 602 list_add_tail(&page->lru, &newlist);
589 nr_pages++; 603 nr_pages++;
590 if (nr_pages > MIGRATE_CHUNK_SIZE) 604 if (nr_pages > MIGRATE_CHUNK_SIZE)
591 break; 605 break;
@@ -940,7 +954,8 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
940 goto out; 954 goto out;
941 } 955 }
942 956
943 err = do_migrate_pages(mm, &old, &new, MPOL_MF_MOVE); 957 err = do_migrate_pages(mm, &old, &new,
958 capable(CAP_SYS_ADMIN) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
944out: 959out:
945 mmput(mm); 960 mmput(mm);
946 return err; 961 return err;
@@ -1778,7 +1793,8 @@ int show_numa_map(struct seq_file *m, void *v)
1778 if (!md) 1793 if (!md)
1779 return 0; 1794 return 0;
1780 1795
1781 check_pgd_range(vma, vma->vm_start, vma->vm_end, 1796 if (!is_vm_hugetlb_page(vma))
1797 check_pgd_range(vma, vma->vm_start, vma->vm_end,
1782 &node_online_map, MPOL_MF_STATS, md); 1798 &node_online_map, MPOL_MF_STATS, md);
1783 1799
1784 if (md->pages) { 1800 if (md->pages) {