mempolicy.c (03e075b38e6cd25267c8d6e2797fa4537ca3348d) mempolicy.c (77bf45e78050790d8f7fc30b87a0ca674bf6265a)
1/*
2 * Simple NUMA memory policy for the Linux kernel.
3 *
4 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
6 * Subject to the GNU Public License, version 2.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 534 unchanged lines hidden (view full) ---

543 if (ret) {
544 pte = pte_offset_map_lock(walk->mm, pmd,
545 addr, &ptl);
546 continue;
547 }
548 goto retry;
549 }
550
1/*
2 * Simple NUMA memory policy for the Linux kernel.
3 *
4 * Copyright 2003,2004 Andi Kleen, SuSE Labs.
5 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc.
6 * Subject to the GNU Public License, version 2.
7 *
8 * NUMA policy allows the user to give hints in which node(s) memory should

--- 534 unchanged lines hidden (view full) ---

543 if (ret) {
544 pte = pte_offset_map_lock(walk->mm, pmd,
545 addr, &ptl);
546 continue;
547 }
548 goto retry;
549 }
550
551 if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
552 migrate_page_add(page, qp->pagelist, flags);
551 migrate_page_add(page, qp->pagelist, flags);
553 }
554 pte_unmap_unlock(pte - 1, ptl);
555 cond_resched();
556 return 0;
557}
558
559static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,
560 unsigned long addr, unsigned long end,

--- 59 unchanged lines hidden (view full) ---

620static int queue_pages_test_walk(unsigned long start, unsigned long end,
621 struct mm_walk *walk)
622{
623 struct vm_area_struct *vma = walk->vma;
624 struct queue_pages *qp = walk->private;
625 unsigned long endvma = vma->vm_end;
626 unsigned long flags = qp->flags;
627
552 }
553 pte_unmap_unlock(pte - 1, ptl);
554 cond_resched();
555 return 0;
556}
557
558static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,
559 unsigned long addr, unsigned long end,

--- 59 unchanged lines hidden (view full) ---

619static int queue_pages_test_walk(unsigned long start, unsigned long end,
620 struct mm_walk *walk)
621{
622 struct vm_area_struct *vma = walk->vma;
623 struct queue_pages *qp = walk->private;
624 unsigned long endvma = vma->vm_end;
625 unsigned long flags = qp->flags;
626
628 if (vma->vm_flags & VM_PFNMAP)
627 if (!vma_migratable(vma))
629 return 1;
630
631 if (endvma > end)
632 endvma = end;
633 if (vma->vm_start > start)
634 start = vma->vm_start;
635
636 if (!(flags & MPOL_MF_DISCONTIG_OK)) {
637 if (!vma->vm_next && vma->vm_end < end)
638 return -EFAULT;
639 if (qp->prev && qp->prev->vm_end < vma->vm_start)
640 return -EFAULT;
641 }
642
643 qp->prev = vma;
644
645 if (flags & MPOL_MF_LAZY) {
646 /* Similar to task_numa_work, skip inaccessible VMAs */
628 return 1;
629
630 if (endvma > end)
631 endvma = end;
632 if (vma->vm_start > start)
633 start = vma->vm_start;
634
635 if (!(flags & MPOL_MF_DISCONTIG_OK)) {
636 if (!vma->vm_next && vma->vm_end < end)
637 return -EFAULT;
638 if (qp->prev && qp->prev->vm_end < vma->vm_start)
639 return -EFAULT;
640 }
641
642 qp->prev = vma;
643
644 if (flags & MPOL_MF_LAZY) {
645 /* Similar to task_numa_work, skip inaccessible VMAs */
647 if (vma_migratable(vma) &&
648 vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))
646 if (vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))
649 change_prot_numa(vma, start, endvma);
650 return 1;
651 }
652
647 change_prot_numa(vma, start, endvma);
648 return 1;
649 }
650
653 if ((flags & MPOL_MF_STRICT) ||
654 ((flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) &&
655 vma_migratable(vma)))
656 /* queue pages from current vma */
651 /* queue pages from current vma */
652 if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
657 return 0;
658 return 1;
659}
660
661/*
662 * Walk through page tables and collect pages to be migrated.
663 *
664 * If pages found in a given range are on a set of nodes (determined by

--- 2203 unchanged lines hidden ---
653 return 0;
654 return 1;
655}
656
657/*
658 * Walk through page tables and collect pages to be migrated.
659 *
660 * If pages found in a given range are on a set of nodes (determined by

--- 2203 unchanged lines hidden ---