freebsd-dev/lib/libthr
Konstantin Belousov 381c2d2e9a Untangle jemalloc and mutexes initialization.
The need to use libc malloc(3) from some places in libthr always
caused issues.  For instance, per-thread key allocation was switched to
use plain mmap(2) to get storage, because some third party mallocs
used keys for implementation of calloc(3).

Even more important, libthr calls calloc(3) during initialization of
pthread mutexes, and jemalloc uses pthread mutexes.  Jemalloc provides
some way to both postpone the initialization, and to make
initialization to use specialized allocator, but this is very fragile
and often breaks.  See the referenced PR for another example.

Add the small malloc implementation used by rtld, to libthr. Use it in
thr_spec.c and for mutexes initialization. This avoids the issues with
mutual dependencies between malloc and libthr in principle.  The
drawback is that some more allocations are not interceptable for
alternate malloc implementations.  There should be not too much memory
use from this allocator, and the alternative, direct use of mmap(2) is
obviously worse.

PR:	235211
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D18988
2019-01-29 22:46:44 +00:00
..
arch lib: further adoption of SPDX licensing ID tags. 2017-11-26 02:00:33 +00:00
sys spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
tests Use MACHINE_CPUARCH in preference MACHINE for userland. 2017-11-07 09:57:26 +00:00
thread Untangle jemalloc and mutexes initialization. 2019-01-29 22:46:44 +00:00
libthr.3
Makefile Untangle jemalloc and mutexes initialization. 2019-01-29 22:46:44 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
plockstat.d
pthread.map Add pthread_get_name_np(3). 2018-08-17 18:34:07 +00:00