[RHEL7,COMMIT] ms/mm/memory.c: share the i_mmap_rwsem

Submitted by Vasily Averin on Dec. 3, 2020, 8:41 a.m.


Message ID 202012030841.0B38fWfn031608@vz7build.vvs.sw.ru
State New
Series "Series without cover letter"
Headers show

Commit Message

Vasily Averin Dec. 3, 2020, 8:41 a.m.
The commit is pushed to "branch-rh7-3.10.0-1160.6.1.vz7.171.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.6.1.vz7.171.1
commit 08cf437ba74b0295154cd92ed1bca44d714119e1
Author: Davidlohr Bueso <dave@stgolabs.net>
Date:   Thu Dec 3 11:41:32 2020 +0300

    ms/mm/memory.c: share the i_mmap_rwsem
    The unmap_mapping_range family of functions do the unmapping of user pages
    (ultimately via zap_page_range_single) without touching the actual
    interval tree, thus share the lock.
    Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
    Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
    Acked-by: Hugh Dickins <hughd@google.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
    Acked-by: Mel Gorman <mgorman@suse.de>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (cherry picked from commit c8475d144abb1e62958cc5ec281d2a9e161c1946)
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/memory.c b/mm/memory.c
index ac2d668..f6017f3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2702,10 +2702,10 @@  void unmap_mapping_range(struct address_space *mapping,
 	if (details.last_index < details.first_index)
 		details.last_index = ULONG_MAX;
-	i_mmap_lock_write(mapping);
+	i_mmap_lock_read(mapping);
 	if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap)))
 		unmap_mapping_range_tree(&mapping->i_mmap, &details);
-	i_mmap_unlock_write(mapping);
+	i_mmap_unlock_read(mapping);