percpu-refcount: add ref_trace_final_put trace
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/4 refcount: add ref_trace_final_put tracepoint
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(+)
include/linux/refcount.h +2 -0
@@ -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; }
Signature · 1 line
2.51.2
PATCH 3/4 percpu-refcount: add ref_trace_final_put trace
In reply to a message not in the archiveAdd the ref_trace_final_put tracepoint to percpu_ref_put_many(). The tracepoint fires when the atomic counter reaches zero in the atomic fallback path (after percpu_ref_kill() has been called).
Signed-off-by Eugene Mavick <[email protected]>
--- include/linux/percpu-refcount.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/percpu-refcount.h +4 -1
@@ -55,6 +55,7 @@#include <linux/rcupdate.h> #include <linux/types.h> #include <linux/gfp.h> +#include <linux/ref_trace.h> struct percpu_ref ;typedef void (percpu_ref_func_t )(struct percpu_ref *);
@@ -331,8 +332,10 @@ static inline void percpu_ref_put_many(struct percpu_ref *ref, unsigned long nr)if (__ref_is_percpu (ref, &percpu_count))this_cpu_sub (*percpu_count, nr); -else if (unlikely (atomic_long_sub_and_test (nr, &ref->data->count))) +else if (unlikely (atomic_long_sub_and_test (nr, &ref->data->count))) { +trace_ref_final_put (ref); ref->data->release (ref); + }rcu_read_unlock (); }
Signature · 1 line
2.51.2