aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_sx.c
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2017-11-17 02:22:51 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2017-11-17 02:22:51 +0000
commitae7d25a4d736392ecf325f3f1386d405e572e830 (patch)
tree6271ad8e258fc1abc50938b9b841e15daaa7725c /sys/kern/kern_sx.c
parent3af300592cdcfa008e8464d47bfc50dbb78a4a22 (diff)
Notes
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r--sys/kern/kern_sx.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c
index 7e7c0b0962f6..f3f38cfd996c 100644
--- a/sys/kern/kern_sx.c
+++ b/sys/kern/kern_sx.c
@@ -551,6 +551,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, uintptr_t tid, int opts,
CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
sx->lock_object.lo_name, (void *)sx->sx_lock, file, line);
+#ifdef HWPMC_HOOKS
+ PMC_SOFT_CALL( , , lock, failed);
+#endif
+ lock_profile_obtain_lock_failed(&sx->lock_object, &contested,
+ &waittime);
+
#ifdef LOCK_PROFILING
extra_work = 1;
state = x;
@@ -571,11 +577,6 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, uintptr_t tid, int opts,
#ifdef KDTRACE_HOOKS
lda.spin_cnt++;
#endif
-#ifdef HWPMC_HOOKS
- PMC_SOFT_CALL( , , lock, failed);
-#endif
- lock_profile_obtain_lock_failed(&sx->lock_object, &contested,
- &waittime);
#ifdef ADAPTIVE_SX
/*
* If the lock is write locked and the owner is
@@ -889,6 +890,12 @@ _sx_slock_hard(struct sx *sx, int opts, const char *file, int line, uintptr_t x)
lock_delay_arg_init(&lda, NULL);
#endif
+#ifdef HWPMC_HOOKS
+ PMC_SOFT_CALL( , , lock, failed);
+#endif
+ lock_profile_obtain_lock_failed(&sx->lock_object, &contested,
+ &waittime);
+
#ifdef LOCK_PROFILING
extra_work = 1;
state = x;
@@ -911,12 +918,6 @@ _sx_slock_hard(struct sx *sx, int opts, const char *file, int line, uintptr_t x)
lda.spin_cnt++;
#endif
-#ifdef HWPMC_HOOKS
- PMC_SOFT_CALL( , , lock, failed);
-#endif
- lock_profile_obtain_lock_failed(&sx->lock_object, &contested,
- &waittime);
-
#ifdef ADAPTIVE_SX
/*
* If the owner is running on another CPU, spin until