mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Add "options ADAPTIVE_GIANT" which causes Giant to also be treated in
an adaptive fashion when adaptive mutexes are enabled. The theory behind non-adaptive Giant is that Giant will be held for long periods of time, and therefore spinning waiting on it is wasteful. However, in MySQL benchmarks which are relatively Giant-free, running Giant adaptive makes an observable difference on SMP (5% transaction rate improvement). As such, make adaptive behavior on Giant an option so it can be more widely benchmarked.
This commit is contained in:
parent
8d59f4fd45
commit
a9abdce44a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132698
@ -173,6 +173,12 @@ options SMP # Symmetric MultiProcessor Kernel
|
||||
# to disable it.
|
||||
options NO_ADAPTIVE_MUTEXES
|
||||
|
||||
# ADAPTIVE_GIANT causes the Giant lock to also be made adaptive when
|
||||
# running without NO_ADAPTIVE_MUTEXES. Normally, because Giant is assumed
|
||||
# to be held for extended periods, contention on Giant will cause a thread
|
||||
# to sleep rather than spinning.
|
||||
options ADAPTIVE_GIANT
|
||||
|
||||
# MUTEX_NOINLINE forces mutex 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
|
||||
|
@ -56,6 +56,7 @@ KDB_TRACE opt_kdb.h
|
||||
KDB_UNATTENDED opt_kdb.h
|
||||
|
||||
# Miscellaneous options.
|
||||
ADAPTIVE_GIANT opt_adaptive_mutexes.h
|
||||
NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h
|
||||
ALQ
|
||||
CODA_COMPAT_5 opt_coda.h
|
||||
|
@ -509,7 +509,11 @@ _mtx_lock_sleep(struct mtx *m, int opts, const char *file, int line)
|
||||
* CPU, spin instead of blocking.
|
||||
*/
|
||||
owner = (struct thread *)(v & MTX_FLAGMASK);
|
||||
#ifdef ADAPTIVE_GIANT
|
||||
if (TD_IS_RUNNING(owner)) {
|
||||
#else
|
||||
if (m != &Giant && TD_IS_RUNNING(owner)) {
|
||||
#endif
|
||||
turnstile_release(&m->mtx_object);
|
||||
while (mtx_owner(m) == owner && TD_IS_RUNNING(owner)) {
|
||||
#if defined(__i386__) || defined(__amd64__)
|
||||
|
Loading…
Reference in New Issue
Block a user