summaryrefslogtreecommitdiffstats
path: root/sys/sys/mutex.h
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2006-12-16 02:37:58 +0000
committerkmacy <kmacy@FreeBSD.org>2006-12-16 02:37:58 +0000
commitad3abace0cb8e4401b0dd5b68b63f1c8405baeef (patch)
treef0bcef7d4d608e41f61c1ec11703db59af89df11 /sys/sys/mutex.h
parent1d3d170d84fa1e6127bdf989319a5d7a91f81745 (diff)
downloadFreeBSD-src-ad3abace0cb8e4401b0dd5b68b63f1c8405baeef.zip
FreeBSD-src-ad3abace0cb8e4401b0dd5b68b63f1c8405baeef.tar.gz
- Fix some gcc warnings in lock_profile.h
- add cnt_hold cnt_lock support for spin mutexes - make sure contested is initialized to zero to only bump contested when appropriate - move initialization function to kern_mutex.c to avoid cyclic dependency between mutex.h and lock_profile.h
Diffstat (limited to 'sys/sys/mutex.h')
-rw-r--r--sys/sys/mutex.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index c5acf6c..90be6cc 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -39,6 +39,7 @@
#ifdef _KERNEL
#include <sys/pcpu.h>
+#include <sys/lock_profile.h>
#include <machine/atomic.h>
#include <machine/cpufunc.h>
#endif /* _KERNEL_ */
@@ -172,14 +173,17 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
#ifdef SMP
#define _get_spin_lock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
+ int contested = 0; \
\
spinlock_enter(); \
if (!_obtain_lock((mp), _tid)) { \
+ lock_profile_obtain_lock_failed(&mp->mtx_object, &contested);\
if ((mp)->mtx_lock == _tid) \
(mp)->mtx_recurse++; \
else \
_mtx_lock_spin((mp), _tid, (opts), (file), (line)); \
} \
+ lock_profile_update_contest_locking(&mp->mtx_object, contested);\
} while (0)
#else /* SMP */
#define _get_spin_lock(mp, tid, opts, file, line) do { \
OpenPOWER on IntegriCloud