[PATCH 63/64] mm/mmap: hack drop down_write_nest_lock()

From: Davidlohr Bueso
Date: Sun Feb 04 2018 - 20:30:54 EST


From: Davidlohr Bueso <dave@xxxxxxxxxxxx>

* THIS IS A HACK *

Directly call down_write() on i_mmap_rwsem (such that
we don't have to convert it to a range lock)

Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
---
mm/mmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index e10d005f7e2f..1d3a5edd19b2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3394,7 +3394,7 @@ 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.
*/
- down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_sem);
+ down_write(&anon_vma->root->rwsem);
/*
* We can safely modify head.next after taking the
* anon_vma->root->rwsem. If some other vma in this mm shares
@@ -3424,7 +3424,7 @@ 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();
- down_write_nest_lock(&mapping->i_mmap_rwsem, &mm->mmap_sem);
+ down_write(&mapping->i_mmap_rwsem);
}
}

--
2.13.6