summaryrefslogtreecommitdiffstats
path: root/mm/mprotect.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mprotect.c')
-rw-r--r--mm/mprotect.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 6d331620b9e5..36cb358db170 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -167,11 +167,12 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
167 pgprot_t newprot, int dirty_accountable, int prot_numa) 167 pgprot_t newprot, int dirty_accountable, int prot_numa)
168{ 168{
169 pmd_t *pmd; 169 pmd_t *pmd;
170 struct mm_struct *mm = vma->vm_mm;
171 unsigned long next; 170 unsigned long next;
172 unsigned long pages = 0; 171 unsigned long pages = 0;
173 unsigned long nr_huge_updates = 0; 172 unsigned long nr_huge_updates = 0;
174 unsigned long mni_start = 0; 173 struct mmu_notifier_range range;
174
175 range.start = 0;
175 176
176 pmd = pmd_offset(pud, addr); 177 pmd = pmd_offset(pud, addr);
177 do { 178 do {
@@ -183,9 +184,9 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
183 goto next; 184 goto next;
184 185
185 /* invoke the mmu notifier if the pmd is populated */ 186 /* invoke the mmu notifier if the pmd is populated */
186 if (!mni_start) { 187 if (!range.start) {
187 mni_start = addr; 188 mmu_notifier_range_init(&range, vma->vm_mm, addr, end);
188 mmu_notifier_invalidate_range_start(mm, mni_start, end); 189 mmu_notifier_invalidate_range_start(&range);
189 } 190 }
190 191
191 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { 192 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) {
@@ -214,8 +215,8 @@ next:
214 cond_resched(); 215 cond_resched();
215 } while (pmd++, addr = next, addr != end); 216 } while (pmd++, addr = next, addr != end);
216 217
217 if (mni_start) 218 if (range.start)
218 mmu_notifier_invalidate_range_end(mm, mni_start, end); 219 mmu_notifier_invalidate_range_end(&range);
219 220
220 if (nr_huge_updates) 221 if (nr_huge_updates)
221 count_vm_numa_events(NUMA_HUGE_PTE_UPDATES, nr_huge_updates); 222 count_vm_numa_events(NUMA_HUGE_PTE_UPDATES, nr_huge_updates);