]> git.karo-electronics.de Git - karo-tx-linux.git/commit
uprobes: counter to optimize probe hits.
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Thu, 15 Dec 2011 13:42:42 +0000 (19:12 +0530)
committerSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Sun, 18 Dec 2011 06:22:57 +0000 (11:52 +0530)
commit3f563d41e3ccab57d94b683d55870dab32a1ff59
tree093dec337247fe35c60022362509b97804034a89
parent59c919d4345ca8361436fed9c50e9fd6e0c16e4c
uprobes: counter to optimize probe hits.

Maintain a per-mm counter (number of uprobes that are inserted on
this process address space). This counter can be used at probe hit
time to determine if we need to do a uprobe lookup in the uprobes
rbtree. Everytime a probe gets inserted successfully, the probe
count is incremented and everytime a probe gets removed successfully
the probe count is removed.

A new hook munmap_uprobe is added to keep the counter to be correct
even when a region is unmapped or remapped. This patch expects that
once a munmap_uprobe() is called, the vma either go away or a
subsequent mmap_uprobe gets called before a removal of a probe from
unregister_uprobe in the same address space.

On every executable vma thats cowed at fork, mmap_uprobe is called
so that the mm_uprobes_count is in sync.

When a vma of interest is mapped, insert the breakpoint at the right
address. Upon munmap, just make sure the data structures are
adjusted/cleaned up.

On process creation, make sure the probes count in the child is set
correctly.

Special cases that are taken care include:
a. mremap()
b. VM_DONTCOPY vmas on fork()
c. insertion/removal races in the parent during fork().

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
include/linux/mm_types.h
include/linux/uprobes.h
kernel/fork.c
kernel/uprobes.c
mm/mmap.c