Re: [PATCH v4 3.0-rc2-tip 7/22] 7: uprobes: mmap and fork hooks.

From: Srikar Dronamraju
Date: Tue Jul 19 2011 - 03:05:50 EST

* Peter Zijlstra <peterz@xxxxxxxxxxxxx> [2011-07-18 16:31:16]:

> On Mon, 2011-07-18 at 14:50 +0530, Srikar Dronamraju wrote:
> > * - Introduce uprobes_list and uprobes_vaddr in vm_area_struct.
> > * uprobes_list is a node in the temp list of vmas while
> > * registering/unregistering uprobes. uprobes_vaddr caches the vaddr to
> > * insert/remove the breakpoint.
> > *
> > * - Introduce srcu to synchronize vma deletion with walking the list of
> > * vma in register/unregister_uprobe.
> I don't think you can sell this, that'll make munmap() horridly slow.


How about using a counter and a wq in each vma.
Based on the counter, I can wait in the munmap() and since this is per
vma, this should be faster than srcu.

Counter would be incremented when we do a vma-rmap walk.
decremented when after insertion/deletion.
read in munmap().

> > * - Introduce uprobes_mmap_mutex to synchronize uprobe deletion and
> > * mmap_uprobe().
> Yes, that'll work I think.

Here another possibility is to have a per uprobe mutex, that way we
would not have to serialize mmap_uprobe. But this optimization can be
done later too.

Thanks and Regards
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at