aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2012-12-02 14:56:46 -0500
committerMel Gorman <mgorman@suse.de>2012-12-11 09:43:00 -0500
commit5a505085f043e8380f83610f79642853c051e2f1 (patch)
treec9e86ee196b1ef87350ee9b268a515e2eae4d307 /mm/mmap.c
parentd28d433512f4f387e2563c14db45a7bb8a338b1a (diff)
mm/rmap: Convert the struct anon_vma::mutex to an rwsem
Convert the struct anon_vma::mutex to an rwsem, which will help in solving a page-migration scalability problem. (Addressed in a separate patch.) The conversion is simple and straightforward: in every case where we mutex_lock()ed we'll now down_write(). Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Reviewed-by: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Turner <pjt@google.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com> Cc: Christoph Lameter <cl@linux.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Mel Gorman <mgorman@suse.de>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 9a796c41e7d9..88408632da66 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2561,15 +2561,15 @@ static void vm_lock_anon_vma(struct mm_struct *mm, struct anon_vma *anon_vma)
2561 * The LSB of head.next can't change from under us 2561 * The LSB of head.next can't change from under us
2562 * because we hold the mm_all_locks_mutex. 2562 * because we hold the mm_all_locks_mutex.
2563 */ 2563 */
2564 mutex_lock_nest_lock(&anon_vma->root->mutex, &mm->mmap_sem); 2564 down_write(&anon_vma->root->rwsem);
2565 /* 2565 /*
2566 * We can safely modify head.next after taking the 2566 * We can safely modify head.next after taking the
2567 * anon_vma->root->mutex. If some other vma in this mm shares 2567 * anon_vma->root->rwsem. If some other vma in this mm shares
2568 * the same anon_vma we won't take it again. 2568 * the same anon_vma we won't take it again.
2569 * 2569 *
2570 * No need of atomic instructions here, head.next 2570 * No need of atomic instructions here, head.next
2571 * can't change from under us thanks to the 2571 * can't change from under us thanks to the
2572 * anon_vma->root->mutex. 2572 * anon_vma->root->rwsem.
2573 */ 2573 */
2574 if (__test_and_set_bit(0, (unsigned long *) 2574 if (__test_and_set_bit(0, (unsigned long *)
2575 &anon_vma->root->rb_root.rb_node)) 2575 &anon_vma->root->rb_root.rb_node))
@@ -2671,7 +2671,7 @@ static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
2671 * 2671 *
2672 * No need of atomic instructions here, head.next 2672 * No need of atomic instructions here, head.next
2673 * can't change from under us until we release the 2673 * can't change from under us until we release the
2674 * anon_vma->root->mutex. 2674 * anon_vma->root->rwsem.
2675 */ 2675 */
2676 if (!__test_and_clear_bit(0, (unsigned long *) 2676 if (!__test_and_clear_bit(0, (unsigned long *)
2677 &anon_vma->root->rb_root.rb_node)) 2677 &anon_vma->root->rb_root.rb_node))