aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mmcnull
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-01-29 22:46:44 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-01-29 22:46:44 +0000
commit381c2d2e9a882f8ba03ab84d6fc06f1347866f65 (patch)
treeff443d681824388ff96efdf1d2ac5e524857e93d /sys/dev/mmcnull
parent7a6d40b22c52a28fb31ee0775128945acf897a01 (diff)
downloadsrc-381c2d2e9a882f8ba03ab84d6fc06f1347866f65.tar.gz
src-381c2d2e9a882f8ba03ab84d6fc06f1347866f65.zip
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
Notes
Notes: svn path=/head/; revision=343566
Diffstat (limited to 'sys/dev/mmcnull')
0 files changed, 0 insertions, 0 deletions