glibc/sysdeps/nptl
Kemi Wang 6310e6be9b Mutex: Add pthread mutex tunables
This patch does not have any functionality change, we only provide a spin
count tunes for pthread adaptive spin mutex. The tunable
glibc.pthread.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 32767 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 would extend my appreciation sincerely to H.J.Lu for his help to refine
this patch series.

	* manual/tunables.texi (POSIX Thread Tunables): New node.
	* nptl/Makefile (libpthread-routines): Add pthread_mutex_conf.
	* nptl/nptl-init.c: Include pthread_mutex_conf.h
	(__pthread_initialize_minimal_internal) [HAVE_TUNABLES]: Call
	 __pthread_tunables_init.
	* nptl/pthreadP.h (MAX_ADAPTIVE_COUNT): Remove.
	(max_adaptive_count): Define.
	* nptl/pthread_mutex_conf.c: New file.
	* nptl/pthread_mutex_conf.h: New file.
	* sysdeps/generic/adaptive_spin_count.h: New file.
	* sysdeps/nptl/dl-tunables.list: New file.
	* nptl/pthread_mutex_lock.c (__pthread_mutex_lock): Use
	max_adaptive_count () not MAX_ADAPTIVE_COUNT.
	* nptl/pthread_mutex_timedlock.c (__pthrad_mutex_timedlock):
	Likewise.

Suggested-by: Andi Kleen <andi.kleen@intel.com>
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Kemi.wang <kemi.wang@intel.com>
2018-12-01 08:19:20 -08:00
..
bits Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP [BZ #23275] 2018-10-17 12:23:04 +02:00
sys Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
aio_misc.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
allocrtsig.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
dl-tunables.list Mutex: Add pthread mutex tunables 2018-12-01 08:19:20 -08:00
fork.c Refactor Linux ARCH_FORK implementation 2018-03-07 17:39:40 -03:00
fork.h Refactor atfork handlers 2018-02-22 16:43:59 -03:00
futex-internal.h [BZ #20271] Add newlines in __libc_fatal calls. 2018-08-31 18:04:32 -07:00
gai_misc.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
Implies Get rid of nptl/sysdeps/pthread/ subdirectory 2014-06-12 13:48:47 -07:00
internaltypes.h Fix comment typo 2018-05-08 14:59:13 +02:00
jmp-unwind.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
libc-lock.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
libc-lockP.h Refactor atfork handlers 2018-02-22 16:43:59 -03:00
librt-cancellation.c Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
lowlevellock-futex.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
lowlevellock.h Fix blocking pthread_join. [BZ #23137] 2018-05-04 10:00:59 +02:00
Makeconfig nptl: Move pthread_atfork to libc_nonshared.a 2018-03-01 08:18:48 +01:00
Makefile Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
malloc-machine.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
pthread-functions.h libc: Extend __libc_freeres framework (Bug 23329). 2018-06-29 22:39:06 -04:00
pthread.h Revert Intel CET changes to __jmp_buf_tag (Bug 22743) 2018-01-25 23:43:46 -08:00
setxid.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
shm-directory.h Update copyright dates with scripts/update-copyrights. 2018-01-01 00:32:25 +00:00
stdio-lock.h Mechanically remove _IO_ name aliases for types and constants. 2018-02-21 14:11:05 -05:00
Subdirs Get rid of nptl/sysdeps/pthread/ subdirectory 2014-06-12 13:48:47 -07:00
tcb-offsets.h Get rid of nptl/sysdeps/pthread/ subdirectory 2014-06-12 13:48:47 -07:00
threads.h Fix ISO C threads installed header and HURD assumption 2018-07-25 17:27:45 -03:00
timer_routines.h Move NPTL-specific code to NPTL-specific header 2018-02-27 00:48:24 +01:00
tst-mqueue8x.c Get rid of nptl/sysdeps/pthread/ subdirectory 2014-06-12 13:48:47 -07:00
unwind-forcedunwind.c libc: Extend __libc_freeres framework (Bug 23329). 2018-06-29 22:39:06 -04:00