[Devel] [PATCH rh7 8/8] ms/mm/memory.c: share the i_mmap_rwsem

Andrey Ryabinin aryabinin at virtuozzo.com
Mon Nov 30 18:28:30 MSK 2020


From: Davidlohr Bueso <dave at stgolabs.net>

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 at suse.de>
Cc: "Kirill A. Shutemov" <kirill at shutemov.name>
Acked-by: Hugh Dickins <hughd at google.com>
Cc: Oleg Nesterov <oleg at redhat.com>
Cc: Peter Zijlstra (Intel) <peterz at infradead.org>
Cc: Rik van Riel <riel at redhat.com>
Cc: Srikar Dronamraju <srikar at linux.vnet.ibm.com>
Acked-by: Mel Gorman <mgorman at suse.de>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

https://jira.sw.ru/browse/PSBM-122663
(cherry picked from commit c8475d144abb1e62958cc5ec281d2a9e161c1946)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 7e66dea08f3f..3e5124d14996 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2712,10 +2712,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);
 }
 EXPORT_SYMBOL(unmap_mapping_range);
 
-- 
2.26.2



More information about the Devel mailing list