diff options
Diffstat (limited to 'include/linux/mmu_notifier.h')
-rw-r--r-- | include/linux/mmu_notifier.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 1d1b1e13f79f..6f32b2b1f76b 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h | |||
@@ -311,14 +311,24 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) | |||
311 | __young; \ | 311 | __young; \ |
312 | }) | 312 | }) |
313 | 313 | ||
314 | /* | ||
315 | * set_pte_at_notify() sets the pte _after_ running the notifier. | ||
316 | * This is safe to start by updating the secondary MMUs, because the primary MMU | ||
317 | * pte invalidate must have already happened with a ptep_clear_flush() before | ||
318 | * set_pte_at_notify() has been invoked. Updating the secondary MMUs first is | ||
319 | * required when we change both the protection of the mapping from read-only to | ||
320 | * read-write and the pfn (like during copy on write page faults). Otherwise the | ||
321 | * old page would remain mapped readonly in the secondary MMUs after the new | ||
322 | * page is already writable by some CPU through the primary MMU. | ||
323 | */ | ||
314 | #define set_pte_at_notify(__mm, __address, __ptep, __pte) \ | 324 | #define set_pte_at_notify(__mm, __address, __ptep, __pte) \ |
315 | ({ \ | 325 | ({ \ |
316 | struct mm_struct *___mm = __mm; \ | 326 | struct mm_struct *___mm = __mm; \ |
317 | unsigned long ___address = __address; \ | 327 | unsigned long ___address = __address; \ |
318 | pte_t ___pte = __pte; \ | 328 | pte_t ___pte = __pte; \ |
319 | \ | 329 | \ |
320 | set_pte_at(___mm, ___address, __ptep, ___pte); \ | ||
321 | mmu_notifier_change_pte(___mm, ___address, ___pte); \ | 330 | mmu_notifier_change_pte(___mm, ___address, ___pte); \ |
331 | set_pte_at(___mm, ___address, __ptep, ___pte); \ | ||
322 | }) | 332 | }) |
323 | 333 | ||
324 | #else /* CONFIG_MMU_NOTIFIER */ | 334 | #else /* CONFIG_MMU_NOTIFIER */ |