path: root/mm/mmu_notifier.c
diff options
authorJérôme Glisse <>2017-08-31 17:17:38 -0400
committerLinus Torvalds <>2017-08-31 16:13:00 -0700
commit5f32b265400de723ab0db23101a75ac073bdd980 (patch)
treeb54683262cf671ce4882729ce2e9f1e25a5f16fe /mm/mmu_notifier.c
parentfb1522e099f0c69f36655af233a64e3f55941f5b (diff)
mm/mmu_notifier: kill invalidate_page
The invalidate_page callback suffered from two pitfalls. First it used to happen after the page table lock was release and thus a new page might have setup before the call to invalidate_page() happened. This is in a weird way fixed by commit c7ab0d2fdc84 ("mm: convert try_to_unmap_one() to use page_vma_mapped_walk()") that moved the callback under the page table lock but this also broke several existing users of the mmu_notifier API that assumed they could sleep inside this callback. The second pitfall was invalidate_page() being the only callback not taking a range of address in respect to invalidation but was giving an address and a page. Lots of the callback implementers assumed this could never be THP and thus failed to invalidate the appropriate range for THP. By killing this callback we unify the mmu_notifier callback API to always take a virtual address range as input. Finally this also simplifies the end user life as there is now two clear choices: - invalidate_range_start()/end() callback (which allow you to sleep) - invalidate_range() where you can not sleep but happen right after page table update under page table lock Signed-off-by: Jérôme Glisse <> Cc: Bernhard Held <> Cc: Adam Borowski <> Cc: Andrea Arcangeli <> Cc: Radim Krčmář <> Cc: Wanpeng Li <> Cc: Paolo Bonzini <> Cc: Takashi Iwai <> Cc: Nadav Amit <> Cc: Mike Galbraith <> Cc: Kirill A. Shutemov <> Cc: axie <> Cc: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/mmu_notifier.c')
1 files changed, 0 insertions, 14 deletions
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index 54ca54562928..314285284e6e 100644
--- a/mm/mmu_notifier.c
+++ b/mm/mmu_notifier.c
@@ -174,20 +174,6 @@ void __mmu_notifier_change_pte(struct mm_struct *mm, unsigned long address,
srcu_read_unlock(&srcu, id);
-void __mmu_notifier_invalidate_page(struct mm_struct *mm,
- unsigned long address)
- struct mmu_notifier *mn;
- int id;
- id = srcu_read_lock(&srcu);
- hlist_for_each_entry_rcu(mn, &mm->mmu_notifier_mm->list, hlist) {
- if (mn->ops->invalidate_page)
- mn->ops->invalidate_page(mn, mm, address);
- }
- srcu_read_unlock(&srcu, id);
void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
unsigned long start, unsigned long end)