uprobes: Teach find_active_uprobe() to clear MMF_HAS_UPROBES
authorOleg Nesterov <oleg@redhat.com>
Sun, 19 Aug 2012 15:41:34 +0000 (17:41 +0200)
committerOleg Nesterov <oleg@redhat.com>
Sat, 15 Sep 2012 15:37:27 +0000 (17:37 +0200)
commit499a4f3ec057a0f79636cc3c1e581bb6e977a30f
tree6c24cbd3d9eeb3d1711da4b5aa114e6ff17955c9
parent9f68f672c47b9bd4cfe0a667ecb0b1382c61e2de
uprobes: Teach find_active_uprobe() to clear MMF_HAS_UPROBES

The wrong MMF_HAS_UPROBES doesn't really hurt, just it triggers
the "slow" and unnecessary handle_swbp() path if the task hits
the non-uprobe breakpoint.

So this patch changes find_active_uprobe() to check every valid
vma and clear MMF_HAS_UPROBES if no uprobes were found. This is
adds the slow O(n) path, but it is only called in unlikely case
when the task hits the normal breakpoint first time after
uprobe_unregister().

Note the "not strictly accurate" comment in mmf_recalc_uprobes().
We can fix this, we only need to teach vma_has_uprobes() to return
a bit more more info, but I am not sure this worth the trouble.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
kernel/events/uprobes.c