summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_mutex.c
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2007-03-01 09:35:48 +0000
committerkmacy <kmacy@FreeBSD.org>2007-03-01 09:35:48 +0000
commit6993a109969a848e4b0fda41cdda69ab65d9a4b9 (patch)
tree28b7efc36f36fa54c22f80ec44e51ce68aabe73c /sys/kern/kern_mutex.c
parent4ead5c57e54ea1dc49accdfa328d88d484599de3 (diff)
downloadFreeBSD-src-6993a109969a848e4b0fda41cdda69ab65d9a4b9.zip
FreeBSD-src-6993a109969a848e4b0fda41cdda69ab65d9a4b9.tar.gz
Evidently I've overestimated gcc's ability to peak inside inline functions
and optimize away unused stack values. The 48 bytes that the lock_profile_object adds to the stack evidently has a measurable performance impact on certain workloads.
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r--sys/kern/kern_mutex.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c
index 00d0353..00ed475 100644
--- a/sys/kern/kern_mutex.c
+++ b/sys/kern/kern_mutex.c
@@ -157,9 +157,9 @@ _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));
@@ -176,7 +176,9 @@ _mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_sleep_lock(m, curthread, opts, file, line);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
void
@@ -200,9 +202,9 @@ _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));
@@ -218,7 +220,9 @@ _mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_spin_lock(m);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
/*
OpenPOWER on IntegriCloud