Thread (6 messages) 6 messages, 2 authors, 7d ago

Re: [PATCH 2/4] refcount: add ref_trace_final_put tracepoint

From: Usama Arif <hidden>
Date: 2026-07-06 10:07:21
Also in: linux-mm, lkml

On Sun, 05 Jul 2026 09:20:52 +0800 Eugene Mavick via B4 Relay [off-list ref] wrote:
quoted hunk ↗ jump to hunk
From: Eugene Mavick <redacted>

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 <redacted>
---
 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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help