From: Liang Chen Date: Sat, 16 Jan 2016 00:57:28 +0000 (-0800) Subject: mm: mempolicy: skip non-migratable VMAs when setting MPOL_MF_LAZY X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d645fc0eabbe783d34a14fbb31768ad8571f0ad4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mm: mempolicy: skip non-migratable VMAs when setting MPOL_MF_LAZY MPOL_MF_LAZY is not visible from userspace since a720094ded8c ("mm: mempolicy: Hide MPOL_NOOP and MPOL_MF_LAZY from userspace for now"), but it should still skip non-migratable VMAs such as VM_IO, VM_PFNMAP, and VM_HUGETLB VMAs, and avoid useless overhead of minor faults. Signed-off-by: Liang Chen Signed-off-by: Gavin Guo Acked-by: Rik van Riel Cc: Mel Gorman Cc: Andi Kleen Cc: Vlastimil Babka Cc: David Rientjes Cc: Naoya Horiguchi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 973434eff9dc..27d135408a22 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -644,7 +644,8 @@ static int queue_pages_test_walk(unsigned long start, unsigned long end, if (flags & MPOL_MF_LAZY) { /* Similar to task_numa_work, skip inaccessible VMAs */ - if (vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)) + if (vma_migratable(vma) && + vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)) change_prot_numa(vma, start, endvma); return 1; }