> Current approach: > > ------------ > register_for_each_vma() / uprobe_mmap() > install_breakpoint() > uprobe_write_opcode() { > if (instruction is not already patched) { > /* Gets called only _once_. */ > increment the reference counter; > patch the instruction; > } > } > ------------ > Lets say a user just installs a breakpoint which is part of USDT (using either a trace or perf (or some other utility) Since the semaphore is not updated, it never hits the probe. This is correct. Now he toggles the semaphore and places a probe at the same spot using systemtap or bcc. The probes will now be active and we see hits. This is also correct. If the user toggles the semaphore or deletes the probe using systemtap/bcc. The probes will still be active. Since the reference count is removed on the last consumer deletion. No? This may be wrong because, we may be unnecessarily hitting the probes. > Thanks, > Ravi