1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Remove the MUTEX_WAKE_ALL option and make it the default behaviour for our

mutexes.
Currently we alredy force MUTEX_WAKE_ALL beacause of some problems with the
!MUTEX_WAKE_ALL case (unavioidable priority inversion).
This commit is contained in:
Attilio Rao 2007-06-08 21:36:52 +00:00
parent 68d4cc614a
commit e682569165
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170441
3 changed files with 0 additions and 43 deletions

View File

@ -226,11 +226,6 @@ options ADAPTIVE_SX
# and WITNESS options.
options MUTEX_NOINLINE
# MUTEX_WAKE_ALL changes the mutex unlock algorithm to wake all waiters
# when a contested mutex is released rather than just awaking the highest
# priority waiter.
options MUTEX_WAKE_ALL
# RWLOCK_NOINLINE forces rwlock operations to call functions to perform each
# operation rather than inlining the simple cases. This can be used to
# shrink the size of the kernel text segment. Note that this behavior is

View File

@ -123,7 +123,6 @@ MFI_DEBUG opt_mfi.h
MFI_DECODE_LOG opt_mfi.h
MPROF_BUFFERS opt_mprof.h
MPROF_HASH_SIZE opt_mprof.h
MUTEX_WAKE_ALL
NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h
NO_ADAPTIVE_RWLOCKS
NSWBUF_MIN opt_swap.h

View File

@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$");
#include "opt_adaptive_mutexes.h"
#include "opt_ddb.h"
#include "opt_global.h"
#include "opt_mutex_wake_all.h"
#include "opt_sched.h"
#include <sys/param.h>
@ -72,15 +71,6 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_extern.h>
/*
* Force MUTEX_WAKE_ALL for now.
* single thread wakeup needs fixes to avoid race conditions with
* priority inheritance.
*/
#ifndef MUTEX_WAKE_ALL
#define MUTEX_WAKE_ALL
#endif
#if defined(SMP) && !defined(NO_ADAPTIVE_MUTEXES)
#define ADAPTIVE_MUTEXES
#endif
@ -349,21 +339,7 @@ _mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts, const char *file,
continue;
}
#ifdef MUTEX_WAKE_ALL
MPASS(v != MTX_CONTESTED);
#else
/*
* The mutex was marked contested on release. This means that
* there are other threads blocked on it. Grab ownership of
* it and propagate its priority to the current thread if
* necessary.
*/
if (v == MTX_CONTESTED) {
m->mtx_lock = tid | MTX_CONTESTED;
turnstile_claim(ts);
break;
}
#endif
/*
* If the mutex isn't already contested and a failure occurs
@ -609,21 +585,8 @@ _mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line)
#else
MPASS(ts != NULL);
#endif
#ifdef MUTEX_WAKE_ALL
turnstile_broadcast(ts, TS_EXCLUSIVE_QUEUE);
_release_lock_quick(m);
#else
if (turnstile_signal(ts, TS_EXCLUSIVE_QUEUE)) {
_release_lock_quick(m);
if (LOCK_LOG_TEST(&m->lock_object, opts))
CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p not held", m);
} else {
m->mtx_lock = MTX_CONTESTED;
if (LOCK_LOG_TEST(&m->lock_object, opts))
CTR1(KTR_LOCK, "_mtx_unlock_sleep: %p still contested",
m);
}
#endif
/*
* This turnstile is now no longer associated with the mutex. We can
* unlock the chain lock so a new turnstile may take it's place.