Add the ref_trace_final_put tracepoint to __refcount_sub_and_test(). This fires when a refcount_t reaches zero, capturing the caller address, the function name, and the refcount_t address.
Signed-off-by: Eugene Mavick <[email protected]> --- include/linux/refcount.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/refcount.h b/include/linux/refcount.h index ba7657ced281..7b1fbf326a21 100644 --- a/include/linux/refcount.h +++ b/include/linux/refcount.h @@ -107,6 +107,7 @@ #include <linux/limits.h> #include <linux/refcount_types.h> #include <linux/spinlock_types.h> +#include <linux/ref_trace.h> struct mutex; @@ -393,6 +394,7 @@ bool __refcount_sub_and_test(int i, refcount_t *r, int *oldp) if (old > 0 && old == i) { smp_acquire__after_ctrl_dep(); + trace_ref_final_put(r); return true; } -- 2.51.2
