mm/gup.c: use is_vm_hugetlb_page() to check whether to follow huge
[linux-2.6-microblaze.git] / mm / gup.c
index 7646bf9..6cb7180 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -323,7 +323,7 @@ static struct page *follow_pmd_mask(struct vm_area_struct *vma,
        pmdval = READ_ONCE(*pmd);
        if (pmd_none(pmdval))
                return no_page_table(vma, flags);
-       if (pmd_huge(pmdval) && vma->vm_flags & VM_HUGETLB) {
+       if (pmd_huge(pmdval) && is_vm_hugetlb_page(vma)) {
                page = follow_huge_pmd(mm, address, pmd, flags);
                if (page)
                        return page;
@@ -433,7 +433,7 @@ static struct page *follow_pud_mask(struct vm_area_struct *vma,
        pud = pud_offset(p4dp, address);
        if (pud_none(*pud))
                return no_page_table(vma, flags);
-       if (pud_huge(*pud) && vma->vm_flags & VM_HUGETLB) {
+       if (pud_huge(*pud) && is_vm_hugetlb_page(vma)) {
                page = follow_huge_pud(mm, address, pud, flags);
                if (page)
                        return page;
@@ -2237,7 +2237,7 @@ static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
                pud_t pud = READ_ONCE(*pudp);
 
                next = pud_addr_end(addr, end);
-               if (pud_none(pud))
+               if (unlikely(!pud_present(pud)))
                        return 0;
                if (unlikely(pud_huge(pud))) {
                        if (!gup_huge_pud(pud, pudp, addr, next, flags,