• O
    uprobes: Kill uprobes_mutex[], separate alloc_uprobe() and __uprobe_register() · 66d06dff
    Oleg Nesterov 提交于
    uprobe_register() and uprobe_unregister() are the only users of
    mutex_lock(uprobes_hash(inode)), and the only reason why we can't
    simply remove it is that we need to ensure that delete_uprobe() is
    not possible after alloc_uprobe() and before consumer_add().
    
    IOW, we need to ensure that when we take uprobe->register_rwsem
    this uprobe is still valid and we didn't race with _unregister()
    which called delete_uprobe() in between.
    
    With this patch uprobe_register() simply checks uprobe_is_active()
    and retries if it hits this very unlikely race. uprobes_mutex[] is
    no longer needed and can be removed.
    
    There is another reason for this change, prepare_uprobe() should be
    folded into alloc_uprobe() and we do not want to hold the extra locks
    around read_mapping_page/etc.
    Signed-off-by: NOleg Nesterov <oleg@redhat.com>
    Acked-by: NAnton Arapov <anton@redhat.com>
    Acked-by: NSrikar Dronamraju <srikar@linux.vnet.ibm.com>
    66d06dff
uprobes.c 38.3 KB