Re: [PATCH 2/4] refcount: add ref_trace_final_put tracepoint
From: Usama Arif
Date: Mon Jul 06 2026 - 06:13:18 EST
On Sun, 05 Jul 2026 09:20:52 +0800 Eugene Mavick via B4 Relay <devnull+m.mavick.dev@xxxxxxxxxx> wrote:
> From: Eugene Mavick <m@xxxxxxxxxx>
>
> 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 <m@xxxxxxxxxx>
> ---
> 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);
Should refcount_dec_if_one() also fire the tracepoint?
> return true;
> }
>
>
> --
> 2.51.2
>
>
>