X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=mm%2Fmempolicy.c;h=83c69f8a64c29dd0878050b3912e5f0c2b1af3ac;hb=920c7a5d0c94b8ce740f1d76fa06422f2a95a757;hp=c1592a94582f8c2950a6a4cf34711f02a35066c6;hpb=cfa76f024f7c9e65169425804e5b32e71f66d0ee;p=powerpc.git diff --git a/mm/mempolicy.c b/mm/mempolicy.c index c1592a9458..83c69f8a64 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -722,12 +722,29 @@ out: } +/* + * Allocate a new page for page migration based on vma policy. + * Start assuming that page is mapped by vma pointed to by @private. + * Search forward from there, if not. N.B., this assumes that the + * list of pages handed to migrate_pages()--which is how we get here-- + * is in virtual address order. + */ static struct page *new_vma_page(struct page *page, unsigned long private, int **x) { struct vm_area_struct *vma = (struct vm_area_struct *)private; + unsigned long uninitialized_var(address); - return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, - page_address_in_vma(page, vma)); + while (vma) { + address = page_address_in_vma(page, vma); + if (address != -EFAULT) + break; + vma = vma->vm_next; + } + + /* + * if !vma, alloc_page_vma() will use task or system default policy + */ + return alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, address); } #else