[PATCH v3 1/3] Tunables: Add tunables of spin count for pthread adaptive spin mutex

Szabolcs Nagy szabolcs.nagy@arm.com
Thu Jun 7 13:07:00 GMT 2018


On 23/05/18 10:22, Kemi Wang wrote:
> This patch does not have any functionality change, we only provide a spin
> count tunes for pthread adaptive spin mutex. The tunable
> glibc.mutex.spin_count tunes can be used by system administrator to squeeze
> system performance according to different hardware capabilities and
> workload characteristics.
> 
> The maximum value of spin count is limited to 30000 to avoid the overflow
> of mutex->__data.__spins variable with the possible type of short in
> pthread_mutex_lock ().
> 
> The default value of spin count is set to 100 with the reference to the
> previous number of times of spinning via trylock. This value would be
> architecture-specific and can be tuned with kinds of benchmarks to fit most
> cases in future.
> 

i'm not against this tunable, but do ppl use
PTHREAD_MUTEX_ADAPTIVE_NP in practice?

it's a non-standard extension, if the normal mutex is not
good enough that should be fixed (e.g. it should do some
spinning on SMP systems if that's useful in general, the
futex syscall overhead is way bigger than a few atomic loads).



More information about the Libc-alpha mailing list