[Devel] [PATCH rh7 5/8] ms/uprobes: share the i_mmap_rwsem
Andrey Ryabinin
aryabinin at virtuozzo.com
Mon Nov 30 18:28:27 MSK 2020
From: Davidlohr Bueso <dave at stgolabs.net>
Both register and unregister call build_map_info() in order to create the
list of mappings before installing or removing breakpoints for every mm
which maps file backed memory. As such, there is no reason to hold the
i_mmap_rwsem exclusively, so share it and allow concurrent readers to
build the mapping data.
Signed-off-by: Davidlohr Bueso <dbueso at suse.de>
Acked-by: Srikar Dronamraju <srikar at linux.vnet.ibm.com>
Acked-by: "Kirill A. Shutemov" <kirill at shutemov.name>
Cc: Oleg Nesterov <oleg at redhat.com>
Acked-by: Hugh Dickins <hughd at google.com>
Acked-by: Peter Zijlstra (Intel) <peterz at infradead.org>
Cc: Rik van Riel <riel at redhat.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 4a23717a236b2ab31efb1651f586126789fc997f)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
kernel/events/uprobes.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 9f312227a769..be501d8d9704 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -690,7 +690,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
int more = 0;
again:
- i_mmap_lock_write(mapping);
+ i_mmap_lock_read(mapping);
vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
if (!valid_vma(vma, is_register))
continue;
@@ -721,7 +721,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
info->mm = vma->vm_mm;
info->vaddr = offset_to_vaddr(vma, offset);
}
- i_mmap_unlock_write(mapping);
+ i_mmap_unlock_read(mapping);
if (!more)
goto out;
--
2.26.2
More information about the Devel
mailing list