From c292a3ceb84f6e71ebae594a979cbd7861df1f66 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 10 Nov 2017 14:55:42 -0800 Subject: [PATCH] scoutfs: add coarse lock lifetime tracing Add tracepoints for allocated lock structs entering the tree and finally being freed. This gives visibility into the lifetime of locks without using much higher frequency per-operation tracing that blow out other events. Signed-off-by: Zach Brown --- kmod/src/lock.c | 2 ++ kmod/src/scoutfs_trace.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/kmod/src/lock.c b/kmod/src/lock.c index c8aff0cc..c91ee5dd 100644 --- a/kmod/src/lock.c +++ b/kmod/src/lock.c @@ -128,6 +128,7 @@ static void put_scoutfs_lock(struct super_block *sb, struct scoutfs_lock *lock) BUG_ON(!lock->refcnt); refs = --lock->refcnt; if (!refs) { + trace_scoutfs_lock_free(sb, lock); rb_erase(&lock->node, &linfo->lock_tree); list_del(&lock->lru_entry); spin_unlock(&linfo->lock); @@ -312,6 +313,7 @@ search: new = NULL; found->refcnt = 1; /* Freed by shrinker or on umount */ found->sequence = ++linfo->seq_cnt; + trace_scoutfs_lock_rb_insert(sb, found); rb_link_node(&found->node, parent, node); rb_insert_color(&found->node, &linfo->lock_tree); scoutfs_inc_counter(sb, lock_alloc); diff --git a/kmod/src/scoutfs_trace.h b/kmod/src/scoutfs_trace.h index aed95f07..50ec00c0 100644 --- a/kmod/src/scoutfs_trace.h +++ b/kmod/src/scoutfs_trace.h @@ -1662,6 +1662,16 @@ DEFINE_EVENT(scoutfs_lock_class, shrink_lock_tree, TP_ARGS(sb, lck) ); +DEFINE_EVENT(scoutfs_lock_class, scoutfs_lock_rb_insert, + TP_PROTO(struct super_block *sb, struct scoutfs_lock *lck), + TP_ARGS(sb, lck) +); + +DEFINE_EVENT(scoutfs_lock_class, scoutfs_lock_free, + TP_PROTO(struct super_block *sb, struct scoutfs_lock *lck), + TP_ARGS(sb, lck) +); + DECLARE_EVENT_CLASS(scoutfs_seg_class, TP_PROTO(struct scoutfs_segment *seg), TP_ARGS(seg),