aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/mprotect.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index f0b087d1069c..5aae39017d6d 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -146,6 +146,8 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
146 146
147 pmd = pmd_offset(pud, addr); 147 pmd = pmd_offset(pud, addr);
148 do { 148 do {
149 unsigned long this_pages;
150
149 next = pmd_addr_end(addr, end); 151 next = pmd_addr_end(addr, end);
150 if (pmd_trans_huge(*pmd)) { 152 if (pmd_trans_huge(*pmd)) {
151 if (next - addr != HPAGE_PMD_SIZE) 153 if (next - addr != HPAGE_PMD_SIZE)
@@ -165,8 +167,9 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
165 } 167 }
166 if (pmd_none_or_clear_bad(pmd)) 168 if (pmd_none_or_clear_bad(pmd))
167 continue; 169 continue;
168 pages += change_pte_range(vma, pmd, addr, next, newprot, 170 this_pages = change_pte_range(vma, pmd, addr, next, newprot,
169 dirty_accountable, prot_numa, &all_same_nidpid); 171 dirty_accountable, prot_numa, &all_same_nidpid);
172 pages += this_pages;
170 173
171 /* 174 /*
172 * If we are changing protections for NUMA hinting faults then 175 * If we are changing protections for NUMA hinting faults then
@@ -174,7 +177,7 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
174 * node. This allows a regular PMD to be handled as one fault 177 * node. This allows a regular PMD to be handled as one fault
175 * and effectively batches the taking of the PTL 178 * and effectively batches the taking of the PTL
176 */ 179 */
177 if (prot_numa && all_same_nidpid) 180 if (prot_numa && this_pages && all_same_nidpid)
178 change_pmd_protnuma(vma->vm_mm, addr, pmd); 181 change_pmd_protnuma(vma->vm_mm, addr, pmd);
179 } while (pmd++, addr = next, addr != end); 182 } while (pmd++, addr = next, addr != end);
180 183