mm: Do not flush TLB during protection change if !pte_present && !migration_entry
[platform/adaptation/renesas_rcar/renesas_kernel.git] / mm / mprotect.c
index 94722a4..7bdbd4b 100644 (file)
@@ -101,8 +101,9 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
                                make_migration_entry_read(&entry);
                                set_pte_at(mm, addr, pte,
                                        swp_entry_to_pte(entry));
+
+                               pages++;
                        }
-                       pages++;
                }
        } while (pte++, addr += PAGE_SIZE, addr != end);
        arch_leave_lazy_mmu_mode();
@@ -145,7 +146,7 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                                split_huge_page_pmd(vma, addr, pmd);
                        else if (change_huge_pmd(vma, pmd, addr, newprot,
                                                 prot_numa)) {
-                               pages += HPAGE_PMD_NR;
+                               pages++;
                                continue;
                        }
                        /* fall through */