diff options
author | kmacy <kmacy@FreeBSD.org> | 2007-03-01 09:35:48 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2007-03-01 09:35:48 +0000 |
commit | 6993a109969a848e4b0fda41cdda69ab65d9a4b9 (patch) | |
tree | 28b7efc36f36fa54c22f80ec44e51ce68aabe73c /sys/kern/kern_sx.c | |
parent | 4ead5c57e54ea1dc49accdfa328d88d484599de3 (diff) | |
download | FreeBSD-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_sx.c')
-rw-r--r-- | sys/kern/kern_sx.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 2381c06..967d7a5 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -228,9 +228,10 @@ _sx_try_xlock(struct sx *sx, const char *file, int line) void _sx_sunlock(struct sx *sx, const char *file, int line) { +#ifdef LOCK_PROFILING struct lock_object lo; int count = -1; - +#endif _sx_assert(sx, SX_SLOCKED, file, line); mtx_lock(sx->sx_lock); @@ -262,15 +263,18 @@ _sx_sunlock(struct sx *sx, const char *file, int line) LOCK_LOG_LOCK("SUNLOCK", &sx->sx_object, 0, 0, file, line); mtx_unlock(sx->sx_lock); +#ifdef LOCK_PROFILING if (count == 0) lock_profile_release_lock(&lo); - +#endif } void _sx_xunlock(struct sx *sx, const char *file, int line) { +#ifdef LOCK_PROFILING struct lock_object lo; +#endif _sx_assert(sx, SX_XLOCKED, file, line); mtx_lock(sx->sx_lock); @@ -298,7 +302,9 @@ _sx_xunlock(struct sx *sx, const char *file, int line) LOCK_LOG_LOCK("XUNLOCK", &sx->sx_object, 0, 0, file, line); mtx_unlock(sx->sx_lock); +#ifdef LOCK_PROFILING lock_profile_release_lock(&lo); +#endif } int |