Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1722811

[PATCH 2/4] dax/mmu_notifier: update to new mmu_notifier semantic

From Jérôme Glisse <jglisse@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/4] dax/mmu_notifier: update to new mmu_notifier semantic
Date 2017-08-29 22:20 +0200
Message-ID <ujV9o-7fs-19@gated-at.bofh.it> (permalink)
References <ujV9o-7fs-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 <jglisse@redhat.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Bernhard Held <berny156@gmx.de>
Cc: Adam Borowski <kilobyte@angband.pl>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Wanpeng Li <kernellwp@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: axie <axie@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/4] mmu_notifier semantic update Jérôme Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200
  Re: [PATCH 0/4] mmu_notifier semantic update Jerome Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200
  [PATCH 4/4] iommu/amd: update to new mmu_notifier_invalidate_page() semantic Jérôme Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200
  [PATCH 2/4] dax/mmu_notifier: update to new mmu_notifier semantic Jérôme Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200
  [PATCH 1/4] mm/mmu_notifier: document new behavior for mmu_notifier_invalidate_page() Jérôme Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200
  [PATCH 3/4] mm/rmap: update to new mmu_notifier_invalidate_page() semantic Jérôme Glisse <jglisse@redhat.com> - 2017-08-29 22:20 +0200

csiph-web