summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_exit.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2008-08-27 02:00:53 +0000
committerjasone <jasone@FreeBSD.org>2008-08-27 02:00:53 +0000
commita734052e9cc1d5fcb1f68103dcaf5e4c9324994d (patch)
tree0e5399c773ca24c377f8a89207f8b7bf90716b12 /lib/libthr/thread/thr_exit.c
parentcad1568d07cb3426f863ebdd3ef86f0befecc497 (diff)
downloadFreeBSD-src-a734052e9cc1d5fcb1f68103dcaf5e4c9324994d.zip
FreeBSD-src-a734052e9cc1d5fcb1f68103dcaf5e4c9324994d.tar.gz
Add thread-specific caching for small size classes, based on magazines.
This caching allows for completely lock-free allocation/deallocation in the steady state, at the expense of likely increased memory use and fragmentation. Reduce the default number of arenas to 2*ncpus, since thread-specific caching typically reduces arena contention. Modify size class spacing to include ranges of 2^n-spaced, quantum-spaced, cacheline-spaced, and subpage-spaced size classes. The advantages are: fewer size classes, reduced false cacheline sharing, and reduced internal fragmentation for allocations that are slightly over 512, 1024, etc. Increase RUN_MAX_SMALL, in order to limit fragmentation for the subpage-spaced size classes. Add a size-->bin lookup table for small sizes to simplify translating sizes to size classes. Include a hard-coded constant table that is used unless custom size class spacing is specified at run time. Add the ability to disable tiny size classes at compile time via MALLOC_TINY.
Diffstat (limited to 'lib/libthr/thread/thr_exit.c')
-rw-r--r--lib/libthr/thread/thr_exit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c
index 4b31a60..4e14311 100644
--- a/lib/libthr/thread/thr_exit.c
+++ b/lib/libthr/thread/thr_exit.c
@@ -36,6 +36,7 @@
#include <pthread.h>
#include "un-namespace.h"
+#include "libc_private.h"
#include "thr_private.h"
void _pthread_exit(void *status);
@@ -95,6 +96,9 @@ _pthread_exit(void *status)
_thread_cleanupspecific();
}
+ /* Tell malloc that the thread is exiting. */
+ _malloc_thread_cleanup();
+
if (!_thr_isthreaded())
exit(0);
OpenPOWER on IntegriCloud