lkml.org 
[lkml]   [2014]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 05/10] uprobes: share the i_mmap_rwsem
    Date
    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@suse.de>
    ---
    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 045b649..7a9e620 100644
    --- a/kernel/events/uprobes.c
    +++ b/kernel/events/uprobes.c
    @@ -724,7 +724,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;
    @@ -755,7 +755,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;
    --
    1.8.4.5


    \
     
     \ /
      Last update: 2014-10-25 00:21    [W:5.582 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site