libthr: Add src.conf variable WITHOUT_PTHREADS_ASSERTIONS

This patch fixes a bug which prevents building libthr without
_PTHREADS_INVARIANTS defined. The default remains to build libthr
with -D_PTHREADS_INVARIANTS. However, with this patch, if one builds
libthr with WITHOUT_PTHREADS_ASSERTIONS=true then the latency to
acquire+release a default pthread mutex is reduced by roughly 5%, and a
robust mutex by roughly 18% (as measured by a simple synthetic test on a
Xeon E5-2697a based machine).

Reviewed by:	jhb, kib, mjg
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40900
This commit is contained in:
Greg Becker 2023-07-06 19:30:02 -05:00 committed by Konstantin Belousov
parent 80bd5ef070
commit 642cd51102
4 changed files with 5 additions and 1 deletions

View File

@ -51,8 +51,10 @@ SYMBOL_MAPS=${.CURDIR}/pthread.map
MAN= libthr.3
.if ${MK_PTHREADS_ASSERTIONS} != "no"
# enable extra internal consistency checks
CFLAGS+=-D_PTHREADS_INVARIANTS
.endif
PRECIOUSLIB=

View File

@ -120,7 +120,7 @@ __weak_reference(_pthread_mutex_getyieldloops_np, pthread_mutex_getyieldloops_np
__weak_reference(_pthread_mutex_isowned_np, pthread_mutex_isowned_np);
static void
mutex_init_link(struct pthread_mutex *m)
mutex_init_link(struct pthread_mutex *m __unused)
{
#if defined(_PTHREADS_INVARIANTS)

View File

@ -159,6 +159,7 @@ __DEFAULT_YES_OPTIONS = \
PKGBOOTSTRAP \
PMC \
PPP \
PTHREADS_ASSERTIONS \
QUOTAS \
RADIUS_SUPPORT \
RBOOTD \

View File

@ -0,0 +1 @@
Disable debugging assertions in pthreads library.