summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-02-05 16:18:59 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-08-14 12:28:41 -0400
commit0c98bc862ca2c0bc9182bc49d9e1de9770f0676c (patch)
tree750d359cebcf6a043bc48e77c2405bee6b0a1215
parent5aeecaf631d97ad97b361dde2b4c4fd7ff1dda80 (diff)
six locks: Lock contended tracepoints
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/six.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index 748003a6e5e0..581aee565e95 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -10,6 +10,8 @@
#include <linux/sched/rt.h>
#include <linux/slab.h>
+#include <trace/events/lock.h>
+
#include "six.h"
#ifdef DEBUG
@@ -454,11 +456,12 @@ static int six_lock_slowpath(struct six_lock *lock, enum six_lock_type type,
smp_mb__after_atomic();
}
+ trace_contention_begin(lock, 0);
+ lock_contended(&lock->dep_map, ip);
+
if (six_optimistic_spin(lock, type))
goto out;
- lock_contended(&lock->dep_map, ip);
-
wait->task = current;
wait->lock_want = type;
wait->lock_acquired = false;
@@ -523,6 +526,7 @@ out:
six_clear_bitmask(lock, SIX_LOCK_HELD_write);
six_lock_wakeup(lock, atomic_read(&lock->state), SIX_LOCK_read);
}
+ trace_contention_end(lock, 0);
return ret;
}