svn commit: r325919 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Fri Nov 17 02:22:52 UTC 2017
Author: mjg
Date: Fri Nov 17 02:22:51 2017
New Revision: 325919
URL: https://svnweb.freebsd.org/changeset/base/325919
Log:
locks: pull up PMC_SOFT_CALLs out of slow path loops
Modified:
head/sys/kern/kern_rwlock.c
head/sys/kern/kern_sx.c
Modified: head/sys/kern/kern_rwlock.c
==============================================================================
--- head/sys/kern/kern_rwlock.c Fri Nov 17 02:21:24 2017 (r325918)
+++ head/sys/kern/kern_rwlock.c Fri Nov 17 02:22:51 2017 (r325919)
@@ -443,6 +443,12 @@ __rw_rlock_hard(volatile uintptr_t *c, struct thread *
#endif
rw = rwlock2rw(c);
+#ifdef HWPMC_HOOKS
+ PMC_SOFT_CALL( , , lock, failed);
+#endif
+ lock_profile_obtain_lock_failed(&rw->lock_object,
+ &contested, &waittime);
+
#ifdef LOCK_PROFILING
doing_lockprof = 1;
state = v;
@@ -460,11 +466,6 @@ __rw_rlock_hard(volatile uintptr_t *c, struct thread *
#ifdef KDTRACE_HOOKS
lda.spin_cnt++;
#endif
-#ifdef HWPMC_HOOKS
- PMC_SOFT_CALL( , , lock, failed);
-#endif
- lock_profile_obtain_lock_failed(&rw->lock_object,
- &contested, &waittime);
#ifdef ADAPTIVE_RWLOCKS
/*
@@ -890,6 +891,12 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, ui
CTR5(KTR_LOCK, "%s: %s contested (lock=%p) at %s:%d", __func__,
rw->lock_object.lo_name, (void *)rw->rw_lock, file, line);
+#ifdef HWPMC_HOOKS
+ PMC_SOFT_CALL( , , lock, failed);
+#endif
+ lock_profile_obtain_lock_failed(&rw->lock_object,
+ &contested, &waittime);
+
#ifdef LOCK_PROFILING
doing_lockprof = 1;
state = v;
@@ -910,11 +917,7 @@ __rw_wlock_hard(volatile uintptr_t *c, uintptr_t v, ui
#ifdef KDTRACE_HOOKS
lda.spin_cnt++;
#endif
-#ifdef HWPMC_HOOKS
- PMC_SOFT_CALL( , , lock, failed);
-#endif
- lock_profile_obtain_lock_failed(&rw->lock_object,
- &contested, &waittime);
+
#ifdef ADAPTIVE_RWLOCKS
/*
* If the lock is write locked and the owner is
Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c Fri Nov 17 02:21:24 2017 (r325918)
+++ head/sys/kern/kern_sx.c Fri Nov 17 02:22:51 2017 (r325919)
@@ -551,6 +551,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, uintptr_t t
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 t
#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 *fi
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;
@@ -910,12 +917,6 @@ _sx_slock_hard(struct sx *sx, int opts, const char *fi
#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
/*
More information about the svn-src-all
mailing list