| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
were obscured by pseudo-opaque pthreads API pointer casting.
|
|
|
|
|
| |
(part of libc) can use pthreads mutexes without causing infinite recursion
during initialization.
|
| |
|
|
|
|
|
| |
this should reduce the chance having to do a syscall when there is no
waiter in the semaphore.
|
|
|
|
| |
warnings.
|
| |
|
|
|
|
|
| |
_thr_umtx_wait_uint() for umtx operation UMTX_OP_WAIT_UINT, use the
function in semaphore operations, this fixed compiler warnings.
|
|
|
|
|
|
|
|
|
|
|
| |
fixes a NULL-dereference of curthread when libstdc+ initializes
the exception handling globals on archs we can't use GNU TLS due
to lack of support in binutils 2.15 (i.e. arm and sparc64), yet,
thus making threaded C++ programs compiled with GCC 4.2.1 work
again on these archs.
Reviewed by: davidxu
MFC after: 3 days
|
|
|
|
| |
implementation always does lock in kernel.
|
| |
|
| |
|
|
|
|
|
|
| |
default (errorcheck) mutexes do.
Noticed by: davidxu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to tune pthread mutex performance:
1. LIBPTHREAD_SPINLOOPS
If a pthread mutex is being locked by another thread, this environment
variable sets total number of spin loops before the current thread
sleeps in kernel, this saves a syscall overhead if the mutex will be
unlocked very soon (well written application code).
2. LIBPTHREAD_YIELDLOOPS
If a pthread mutex is being locked by other threads, this environment
variable sets total number of sched_yield() loops before the currrent
thread sleeps in kernel. if a pthread mutex is locked, the current thread
gives up cpu, but will not sleep in kernel, this means, current thread
does not set contention bit in mutex, but let lock owner to run again
if the owner is on kernel's run queue, and when lock owner unlocks the
mutex, it does not need to enter kernel and do lots of work to resume
mutex waiters, in some cases, this saves lots of syscall overheads for
mutex owner.
In my practice, sometimes LIBPTHREAD_YIELDLOOPS can massively improve performance
than LIBPTHREAD_SPINLOOPS, this depends on application. These two environments
are global to all pthread mutex, there is no interface to set them for each
pthread mutex, the default values are zero, this means spinning is turned off
by default.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is also implemented in glibc and is used by a number of existing
applications (mysql, firefox, etc).
This mutex type is a default mutex with the additional property that
it spins briefly when attempting to acquire a contested lock, doing
trylock operations in userland before entering the kernel to block if
eventually unsuccessful.
The expectation is that applications requesting this mutex type know
that the mutex is likely to be only held for very brief periods, so it
is faster to spin in userland and probably succeed in acquiring the
mutex, than to enter the kernel and sleep, only to be woken up almost
immediately. This can help significantly in certain cases when
pthread mutexes are heavily contended and held for brief durations
(such as mysql).
Spin up to 200 times before entering the kernel, which represents only
a few us on modern CPUs. No performance degradation was observed with
this value and it is sufficient to avoid a large performance drop in
mysql performance in the heavily contended pthread mutex case.
The libkse implementation is a NOP.
Reviewed by: jeff
MFC after: 3 days
|
| |
|
|
|
|
| |
Submitted by: jasone
|
|
|
|
| |
Approved by: re (bmah)
|
| |
|
|
|
|
|
|
|
| |
THR_THREAD_LOCK and THR_THREAD_UNLOCK instead, this should fix wrong
lock level problem.
Bug reported by: ed dot maste at gmail dot com
|
| |
|
| |
|
| |
|
|
|
|
| |
mutex in right order sorted by priority ceiling.
|
|
|
|
| |
mutexes.
|
|
|
|
| |
it as a default spin cycle count.
|
|
|
|
|
| |
- Rename _thr_smp_cpus to boolean variable _thr_is_smp.
- Define CPU_SPINWAIT macro for each arch, only X86 supports it.
|
|
|
|
|
| |
operation, if it is failed, we call syscall directly, this saves
one atomic operation per lock contention.
|
| |
|
|
|
|
|
|
|
| |
_thr_ucond_broadcast, clear condition variable pointer in cancellation
info after returing from _thr_ucond_wait, since kernel has already
dropped the internal lock, so we don't need to unlock it in cancellation
handler again.
|
| |
|
| |
|
|
|
|
| |
alarm code.
|
| |
|
| |
|
| |
|
|
|
|
| |
by compiler.
|
|
|
|
| |
condition variable.
|
|
|
|
|
|
|
|
| |
is also returned by pthread_detach() if a thread was already
detached, the error code was already documented:
> [EINVAL] The implementation has detected that the value speci-
> fied by thread does not refer to a joinable thread.
|
|
|
|
| |
reduce overheads of cancellation points.
|
| |
|
|
|
|
|
| |
only has one thread, setting the flag can cause the thread to be
suspended and no another thread will resume it.
|
|
|
|
|
|
| |
o Eliminate unused parameter for some functions.
o Convert type of first parameter to void * for _thr_umtx_wait
and _thr_umtx_wake.
|
| |
|
| |
|
| |
|
|
|
|
| |
real-time if we want, no functionality is changed.
|
| |
|
| |
|
| |
|
| |
|