mm, dax: check for pmd_none() after split_huge_pmd()
[deliverable/linux.git] / mm / mprotect.c
index c764402c464f10471d4b267fa26911f46e87e149..f7cb3d4d9c2eb55d74738e374faa3bfa37251686 100644 (file)
@@ -149,7 +149,8 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                unsigned long this_pages;
 
                next = pmd_addr_end(addr, end);
-               if (!pmd_trans_huge(*pmd) && pmd_none_or_clear_bad(pmd))
+               if (!pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)
+                               && pmd_none_or_clear_bad(pmd))
                        continue;
 
                /* invoke the mmu notifier if the pmd is populated */
@@ -158,10 +159,12 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                        mmu_notifier_invalidate_range_start(mm, mni_start, end);
                }
 
-               if (pmd_trans_huge(*pmd)) {
-                       if (next - addr != HPAGE_PMD_SIZE)
-                               split_huge_page_pmd(vma, addr, pmd);
-                       else {
+               if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
+                       if (next - addr != HPAGE_PMD_SIZE) {
+                               split_huge_pmd(vma, pmd, addr);
+                               if (pmd_none(*pmd))
+                                       continue;
+                       } else {
                                int nr_ptes = change_huge_pmd(vma, pmd, addr,
                                                newprot, prot_numa);
 
This page took 0.030602 seconds and 5 git commands to generate.