summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2007-03-02 07:21:20 +0000
committerkmacy <kmacy@FreeBSD.org>2007-03-02 07:21:20 +0000
commite1b1eae5923c01f8e3a48519bd065108ac5fad4d (patch)
treeebf400e9b11dfb845d138f5eed5195c04faef4a9 /sys/kern/kern_mutex.c
parent2d1909f3b99f9a3cb7031477a90f9d71abd25e6d (diff)
downloadFreeBSD-src-e1b1eae5923c01f8e3a48519bd065108ac5fad4d.zip
FreeBSD-src-e1b1eae5923c01f8e3a48519bd065108ac5fad4d.tar.gz
lock stats updates need to be protected by the lock
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 00ed475..dc58adb 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -157,9 +157,6 @@ _mtx_lock_flags(struct mtx *m, int opts, const char *file, int line)
void
_mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
{
-#ifdef LOCK_PROFILING
- struct lock_object lo;
-#endif
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
@@ -171,14 +168,9 @@ _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file,
line);
mtx_assert(m, MA_OWNED);
-#ifdef LOCK_PROFILING
- memcpy(&lo, &m->mtx_object, sizeof(lo));
- m->mtx_object.lo_flags &= ~LO_CONTESTED;
-#endif
+
+ lock_profile_release_lock(&m->mtx_object);
_rel_sleep_lock(m, curthread, opts, file, line);
-#ifdef LOCK_PROFILING
- lock_profile_release_lock(&lo);
-#endif
}
void
@@ -202,9 +194,7 @@ _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file, int line)
void
_mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
{
-#ifdef LOCK_PROFILING
- struct lock_object lo;
-#endif
+
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line));
@@ -215,14 +205,9 @@ _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
LOCK_LOG_LOCK("UNLOCK", &m->mtx_object, opts, m->mtx_recurse, file,
line);
mtx_assert(m, MA_OWNED);
-#ifdef LOCK_PROFILING
- memcpy(&lo, &m->mtx_object, sizeof(lo));
- m->mtx_object.lo_flags &= ~LO_CONTESTED;
-#endif
+
+ lock_profile_release_lock(&m->mtx_object);
_rel_spin_lock(m);
-#ifdef LOCK_PROFILING
- lock_profile_release_lock(&lo);
-#endif
}
/*
OpenPOWER on IntegriCloud