Thread (1 message) 1 message, 1 author, 8d ago
DORMANTno replies

[PATCH 2/4] refcount: add ref_trace_final_put tracepoint

From: Eugene Mavick <hidden>
Date: 2026-07-06 06:47:44
Also in: linux-mm, lkml
Subsystem: atomic infrastructure, the rest · Maintainers: Will Deacon, Peter Zijlstra, Boqun Feng, Linus Torvalds

Possibly related (same subject, not in this thread)

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);
 		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