diff options
author | DJ Delorie <dj@delorie.com> | 2017-07-06 13:37:30 -0400 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2017-07-06 13:37:30 -0400 |
commit | d5c3fafc4307c9b7a4c7d5cb381fcdbfad340bcc (patch) | |
tree | 380cfbc329860434d6b29825bd02ba5f0c7d4b30 /malloc/arena.c | |
parent | 3cefdd7310a5d1fad45648d9346e47df9c185fdc (diff) | |
download | glibc-d5c3fafc4307c9b7a4c7d5cb381fcdbfad340bcc.tar.gz glibc-d5c3fafc4307c9b7a4c7d5cb381fcdbfad340bcc.tar.xz glibc-d5c3fafc4307c9b7a4c7d5cb381fcdbfad340bcc.zip |
Add per-thread cache to malloc
* config.make.in: Enable experimental malloc option. * configure.ac: Likewise. * configure: Regenerate. * manual/install.texi: Document it. * INSTALL: Regenerate. * malloc/Makefile: Likewise. * malloc/malloc.c: Add per-thread cache (tcache). (tcache_put): New. (tcache_get): New. (tcache_thread_freeres): New. (tcache_init): New. (__libc_malloc): Use cached chunks if available. (__libc_free): Initialize tcache if needed. (__libc_realloc): Likewise. (__libc_calloc): Likewise. (_int_malloc): Prefill tcache when appropriate. (_int_free): Likewise. (do_set_tcache_max): New. (do_set_tcache_count): New. (do_set_tcache_unsorted_limit): New. * manual/probes.texi: Document new probes. * malloc/arena.c: Add new tcache tunables. * elf/dl-tunables.list: Likewise. * manual/tunables.texi: Document them. * NEWS: Mention the per-thread cache.
Diffstat (limited to 'malloc/arena.c')
-rw-r--r-- | malloc/arena.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index 660d638c93..dc14fae152 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -236,6 +236,11 @@ TUNABLE_CALLBACK_FNDECL (set_perturb_byte, int32_t) TUNABLE_CALLBACK_FNDECL (set_trim_threshold, size_t) TUNABLE_CALLBACK_FNDECL (set_arena_max, size_t) TUNABLE_CALLBACK_FNDECL (set_arena_test, size_t) +#if USE_TCACHE +TUNABLE_CALLBACK_FNDECL (set_tcache_max, size_t) +TUNABLE_CALLBACK_FNDECL (set_tcache_count, size_t) +TUNABLE_CALLBACK_FNDECL (set_tcache_unsorted_limit, size_t) +#endif #else /* Initialization routine. */ #include <string.h> @@ -322,6 +327,12 @@ ptmalloc_init (void) TUNABLE_GET (mmap_max, int32_t, TUNABLE_CALLBACK (set_mmaps_max)); TUNABLE_GET (arena_max, size_t, TUNABLE_CALLBACK (set_arena_max)); TUNABLE_GET (arena_test, size_t, TUNABLE_CALLBACK (set_arena_test)); +#if USE_TCACHE + TUNABLE_GET (tcache_max, size_t, TUNABLE_CALLBACK (set_tcache_max)); + TUNABLE_GET (tcache_count, size_t, TUNABLE_CALLBACK (set_tcache_count)); + TUNABLE_GET (tcache_unsorted_limit, size_t, + TUNABLE_CALLBACK (set_tcache_unsorted_limit)); +#endif __libc_lock_unlock (main_arena.mutex); #else const char *s = NULL; |