]> Pileus Git - ~andy/linux/blobdiff - mm/mprotect.c
mm: Only flush TLBs if a transhuge PMD is modified for NUMA pte scanning
[~andy/linux] / mm / mprotect.c
index 7bdbd4b0f6d9306d7d38007b6c17eaeed4e98c25..2da33dca613426a817dd500ff48f1180aa0239a7 100644 (file)
@@ -144,10 +144,16 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                if (pmd_trans_huge(*pmd)) {
                        if (next - addr != HPAGE_PMD_SIZE)
                                split_huge_page_pmd(vma, addr, pmd);
-                       else if (change_huge_pmd(vma, pmd, addr, newprot,
-                                                prot_numa)) {
-                               pages++;
-                               continue;
+                       else {
+                               int nr_ptes = change_huge_pmd(vma, pmd, addr,
+                                               newprot, prot_numa);
+
+                               if (nr_ptes) {
+                                       if (nr_ptes == HPAGE_PMD_NR)
+                                               pages++;
+
+                                       continue;
+                               }
                        }
                        /* fall through */
                }