diff options
author | jhb <jhb@FreeBSD.org> | 2007-03-22 16:09:23 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2007-03-22 16:09:23 +0000 |
commit | ec6d5dd10f12c768cbb975d10e8631d80dbaedaf (patch) | |
tree | 69d3ab7d12cac26ee972a8c1dc9da19a04dbe951 /sys/kern/kern_mutex.c | |
parent | fe8d58a25179cd902bada0d91a0f2921ecd09934 (diff) | |
download | FreeBSD-src-ec6d5dd10f12c768cbb975d10e8631d80dbaedaf.zip FreeBSD-src-ec6d5dd10f12c768cbb975d10e8631d80dbaedaf.tar.gz |
- Simplify the #ifdef's for adaptive mutexes and rwlocks by conditionally
defining a macro earlier in the file.
- Add NO_ADAPTIVE_RWLOCKS option to disable adaptive spinning for rwlocks.
Diffstat (limited to 'sys/kern/kern_mutex.c')
-rw-r--r-- | sys/kern/kern_mutex.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/kern/kern_mutex.c b/sys/kern/kern_mutex.c index 987e5ec..9cff711 100644 --- a/sys/kern/kern_mutex.c +++ b/sys/kern/kern_mutex.c @@ -81,6 +81,10 @@ __FBSDID("$FreeBSD$"); #define MUTEX_WAKE_ALL #endif +#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES) +#define ADAPTIVE_MUTEXES +#endif + /* * Internal utility macros. */ @@ -299,7 +303,7 @@ void _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file, int line) { -#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES) +#ifdef ADAPTIVE_MUTEXES volatile struct thread *owner; #endif #ifdef KTR @@ -365,7 +369,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file, continue; } -#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES) +#ifdef ADAPTIVE_MUTEXES /* * If the current owner of the lock is executing on another * CPU, spin instead of blocking. @@ -383,7 +387,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file, } continue; } -#endif /* SMP && !NO_ADAPTIVE_MUTEXES */ +#endif /* ADAPTIVE_MUTEXES */ /* * We definitely must sleep for this lock. @@ -498,7 +502,7 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line) if (LOCK_LOG_TEST(&m->lock_object, opts)) CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p contested", m); -#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES) +#ifdef ADAPTIVE_MUTEXES if (ts == NULL) { _release_lock_quick(m); if (LOCK_LOG_TEST(&m->lock_object, opts)) |