summaryrefslogtreecommitdiffstats
path: root/sys/sys/mutex.h
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2007-04-03 22:52:31 +0000
committerkmacy <kmacy@FreeBSD.org>2007-04-03 22:52:31 +0000
commit58561e082b9a9488c4752a86c4b63b5c1fbf1c9d (patch)
tree6fadb20338a7e5d191023a5feddd956bb55299c3 /sys/sys/mutex.h
parentcd89273202c5020ecb298750dd1c7926e03fc318 (diff)
downloadFreeBSD-src-58561e082b9a9488c4752a86c4b63b5c1fbf1c9d.zip
FreeBSD-src-58561e082b9a9488c4752a86c4b63b5c1fbf1c9d.tar.gz
move lock_profile calls out of the macros and into kern_mutex.c
add check for mtx_recurse == 0 when releasing sleep lock
Diffstat (limited to 'sys/sys/mutex.h')
-rw-r--r--sys/sys/mutex.h26
1 files changed, 10 insertions, 16 deletions
diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h
index dea4b76..4116e38 100644
--- a/sys/sys/mutex.h
+++ b/sys/sys/mutex.h
@@ -156,15 +156,11 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
#ifndef _get_sleep_lock
#define _get_sleep_lock(mp, tid, opts, file, line) do { \
uintptr_t _tid = (uintptr_t)(tid); \
- int contested = 0; \
- uint64_t waittime = 0; \
if (!_obtain_lock((mp), _tid)) { \
- lock_profile_obtain_lock_failed(&(mp)->lock_object, \
- &contested, &waittime); \
_mtx_lock_sleep((mp), _tid, (opts), (file), (line)); \
- } \
- lock_profile_obtain_lock_success(&(mp)->lock_object, contested, \
- waittime, (file), (line)); \
+ } else \
+ lock_profile_obtain_lock_success(&(mp)->lock_object, 0, \
+ 0, (file), (line)); \
} while (0)
#endif
@@ -179,20 +175,16 @@ 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; \
- uint64_t waittime = 0; \
spinlock_enter(); \
if (!_obtain_lock((mp), _tid)) { \
if ((mp)->mtx_lock == _tid) \
(mp)->mtx_recurse++; \
else { \
- lock_profile_obtain_lock_failed(&(mp)->lock_object, \
- &contested, &waittime); \
_mtx_lock_spin((mp), _tid, (opts), (file), (line)); \
} \
- } \
- lock_profile_obtain_lock_success(&(mp)->lock_object, contested, \
- waittime, (file), (line)); \
+ } else \
+ lock_profile_obtain_lock_success(&(mp)->lock_object, 0, \
+ 0, (file), (line)); \
} while (0)
#else /* SMP */
#define _get_spin_lock(mp, tid, opts, file, line) do { \
@@ -237,9 +229,11 @@ void _mtx_assert(struct mtx *m, int what, const char *file, int line);
#define _rel_spin_lock(mp) do { \
if (mtx_recursed((mp))) \
(mp)->mtx_recurse--; \
- else \
+ else { \
+ lock_profile_release_lock(&(mp)->lock_object); \
_release_lock_quick((mp)); \
- spinlock_exit(); \
+ } \
+ spinlock_exit(); \
} while (0)
#else /* SMP */
#define _rel_spin_lock(mp) do { \
OpenPOWER on IntegriCloud