mmu_notifier_invalidate_page() can now be call from under the spinlock. Move it approprietly and add a call to mmu_notifier_invalidate_range() for user that need to be able to sleep.
Signed-off-by: Jérôme Glisse <[email protected]> Cc: Dan Williams <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Bernhard Held <[email protected]> Cc: Adam Borowski <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Radim Krčmář <[email protected]> Cc: Wanpeng Li <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Takashi Iwai <[email protected]> Cc: Nadav Amit <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: axie <[email protected]> Cc: Andrew Morton <[email protected]> --- fs/dax.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 865d42c63e23..23cfb055e92e 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -650,7 +650,7 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, i_mmap_lock_read(mapping); vma_interval_tree_foreach(vma, &mapping->i_mmap, index, index) { - unsigned long address; + unsigned long start, address, end; cond_resched(); @@ -676,6 +676,9 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, pmd = pmd_wrprotect(pmd); pmd = pmd_mkclean(pmd); set_pmd_at(vma->vm_mm, address, pmdp, pmd); + start = address & PMD_MASK; + end = start + PMD_SIZE; + mmu_notifier_invalidate_page(vma->vm_mm, address); changed = true; unlock_pmd: spin_unlock(ptl); @@ -691,13 +694,16 @@ static void dax_mapping_entry_mkclean(struct address_space *mapping, pte = pte_wrprotect(pte); pte = pte_mkclean(pte); set_pte_at(vma->vm_mm, address, ptep, pte); + mmu_notifier_invalidate_page(vma->vm_mm, address); changed = true; + start = address; + end = start + PAGE_SIZE; unlock_pte: pte_unmap_unlock(ptep, ptl); } if (changed) - mmu_notifier_invalidate_page(vma->vm_mm, address); + mmu_notifier_invalidate_range(vma->vm_mm, start, end); } i_mmap_unlock_read(mapping); } -- 2.13.5

