diff options
author | Qi Wang <interwq@gwu.edu> | 2022-10-21 15:10:48 -0700 |
---|---|---|
committer | Qi Wang <interwq@gmail.com> | 2022-10-25 09:54:38 -0700 |
commit | 143e9c4a2f4eb8916e9802323485fd91260fd17c (patch) | |
tree | 9e7b4e57c92fa8a62be1e3005be9887476ecc9e0 /include/jemalloc | |
parent | be65438f20a5fe4fdc5c5bb2cfa7ba3f0e9da378 (diff) | |
download | jemalloc-143e9c4a2f4eb8916e9802323485fd91260fd17c.tar.gz |
Enable fast thread locals for dealloc-only threads.
Previously if a thread does only allocations, it stays on the slow path /
minimal initialized state forever. However, dealloc-only is a valid pattern for
dedicated reclamation threads -- this means thread cache is disabled (no batched
flush) for them, which causes high overhead and contention.
Added the condition to fully initialize TSD when a fair amount of dealloc
activities are observed.
Diffstat (limited to 'include/jemalloc')
-rw-r--r-- | include/jemalloc/internal/tsd.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/jemalloc/internal/tsd.h b/include/jemalloc/internal/tsd.h index 66d68822..c6bf28fc 100644 --- a/include/jemalloc/internal/tsd.h +++ b/include/jemalloc/internal/tsd.h @@ -59,6 +59,7 @@ typedef ql_elm(tsd_t) tsd_link_t; #define TSD_DATA_SLOW \ O(tcache_enabled, bool, bool) \ O(reentrancy_level, int8_t, int8_t) \ + O(min_init_state_nfetched, uint8_t, uint8_t) \ O(thread_allocated_last_event, uint64_t, uint64_t) \ O(thread_allocated_next_event, uint64_t, uint64_t) \ O(thread_deallocated_last_event, uint64_t, uint64_t) \ @@ -91,6 +92,7 @@ typedef ql_elm(tsd_t) tsd_link_t; #define TSD_DATA_SLOW_INITIALIZER \ /* tcache_enabled */ TCACHE_ENABLED_ZERO_INITIALIZER, \ /* reentrancy_level */ 0, \ + /* min_init_state_nfetched */ 0, \ /* thread_allocated_last_event */ 0, \ /* thread_allocated_next_event */ 0, \ /* thread_deallocated_last_event */ 0, \ @@ -177,6 +179,8 @@ void tsd_global_slow_inc(tsdn_t *tsdn); void tsd_global_slow_dec(tsdn_t *tsdn); bool tsd_global_slow(); +#define TSD_MIN_INIT_STATE_MAX_FETCHED (128) + enum { /* Common case --> jnz. */ tsd_state_nominal = 0, |