[RFC PATCH 18/24] shared file mappings: use the vmf->range field when dropping mmap_sem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modify lock_page_maybe_drop_mmap() and maybe_unlock_mmap_for_io()
to use the vmf->range field when dropping mmap_sem.

This covers dropping mmap_sem during:
- filemap_fault()
- shmem_fault()
- do_fault() write to shared file mapping
  [ through do_shared_fault and fault_dirty_shared_page() ]
- do_wp_page() write to shared file mapping
  [ through wp_page_shared() and fault_dirty_shared_page() ]

Signed-off-by: Michel Lespinasse <walken@xxxxxxxxxx>
---
 mm/filemap.c  | 3 ++-
 mm/internal.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git mm/filemap.c mm/filemap.c
index 3afb5a3f0b9c..7827de7b356c 100644
--- mm/filemap.c
+++ mm/filemap.c
@@ -2364,7 +2364,8 @@ static int lock_page_maybe_drop_mmap(struct vm_fault *vmf, struct page *page,
 			 * mmap_sem here and return 0 if we don't have a fpin.
 			 */
 			if (*fpin == NULL)
-				mm_read_unlock(vmf->vma->vm_mm);
+				mm_read_range_unlock(vmf->vma->vm_mm,
+						     vmf->range);
 			return 0;
 		}
 	} else
diff --git mm/internal.h mm/internal.h
index 22f361a1e284..9bfff428c5da 100644
--- mm/internal.h
+++ mm/internal.h
@@ -382,7 +382,7 @@ static inline struct file *maybe_unlock_mmap_for_io(struct vm_fault *vmf,
 	if ((flags & (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT)) ==
 	    FAULT_FLAG_ALLOW_RETRY) {
 		fpin = get_file(vmf->vma->vm_file);
-		mm_read_unlock(vmf->vma->vm_mm);
+		mm_read_range_unlock(vmf->vma->vm_mm, vmf->range);
 	}
 	return fpin;
 }
-- 
2.25.0.341.g760bfbb309-goog





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux