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


Groups > linux.kernel > #1649490

[RFC v2 02/10] mm: Remove nest locking operation with mmap_sem

From Laurent Dufour <ldufour@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [RFC v2 02/10] mm: Remove nest locking operation with mmap_sem
Date 2017-05-24 13:30 +0200
Message-ID <tKCEi-1Hm-25@gated-at.bofh.it> (permalink)
References <tKCEh-1Hm-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The range locking framework doesn't yet provide nest locking
operation.

Once the range locking API while provide nested operation support,
this patch will have to be reviewed.

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
---
 mm/mmap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mm/mmap.c b/mm/mmap.c
index f82741e199c0..87c8625ae91d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3284,7 +3284,11 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
 		 * The LSB of head.next can't change from under us
 		 * because we hold the mm_all_locks_mutex.
 		 */
+#ifndef CONFIG_MEM_RANGE_LOCK
 		down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_sem);
+#else
+		down_write(&anon_vma->root->rwsem);
+#endif
 		/*
 		 * We can safely modify head.next after taking the
 		 * anon_vma->root->rwsem. If some other vma in this mm shares
@@ -3314,7 +3318,11 @@ static void vm_lock_mapping(struct mm_struct *mm, struct address_space *mapping)
 		 */
 		if (test_and_set_bit(AS_MM_ALL_LOCKS, &mapping->flags))
 			BUG();
+#ifndef CONFIG_MEM_RANGE_LOCK
 		down_write_nest_lock(&mapping->i_mmap_rwsem, &mm->mmap_sem);
+#else
+		down_write(&mapping->i_mmap_rwsem);
+#endif
 	}
 }
 
-- 
2.7.4

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


Thread

[RFC v2 00/10] Replace mmap_sem by a range lock Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 06/10] mm: Add a range lock parameter to lock_page_or_retry() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 03/10] mm: Add a range parameter to the vm_fault structure Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 02/10] mm: Remove nest locking operation with mmap_sem Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 04/10] mm: Handle range lock field when collapsing huge pages Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 08/10] mm: Define mem range lock operations Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 07/10] mm: Add a range lock parameter to GUP() and handle_page_fault() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 05/10] mm: Add a range lock parameter to userfaultfd_remove() Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 01/10] mm: Deactivate mmap_sem assert Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200
  [RFC v2 10/10] mm: Introduce CONFIG_MEM_RANGE_LOCK Laurent Dufour <ldufour@linux.vnet.ibm.com> - 2017-05-24 13:30 +0200

csiph-web