1*8e33eff8Schristos #ifndef JEMALLOC_INTERNAL_TCACHE_EXTERNS_H 2*8e33eff8Schristos #define JEMALLOC_INTERNAL_TCACHE_EXTERNS_H 3*8e33eff8Schristos 4*8e33eff8Schristos #include "jemalloc/internal/size_classes.h" 5*8e33eff8Schristos 6*8e33eff8Schristos extern bool opt_tcache; 7*8e33eff8Schristos extern ssize_t opt_lg_tcache_max; 8*8e33eff8Schristos 9*8e33eff8Schristos extern cache_bin_info_t *tcache_bin_info; 10*8e33eff8Schristos 11*8e33eff8Schristos /* 12*8e33eff8Schristos * Number of tcache bins. There are NBINS small-object bins, plus 0 or more 13*8e33eff8Schristos * large-object bins. 14*8e33eff8Schristos */ 15*8e33eff8Schristos extern unsigned nhbins; 16*8e33eff8Schristos 17*8e33eff8Schristos /* Maximum cached size class. */ 18*8e33eff8Schristos extern size_t tcache_maxclass; 19*8e33eff8Schristos 20*8e33eff8Schristos /* 21*8e33eff8Schristos * Explicit tcaches, managed via the tcache.{create,flush,destroy} mallctls and 22*8e33eff8Schristos * usable via the MALLOCX_TCACHE() flag. The automatic per thread tcaches are 23*8e33eff8Schristos * completely disjoint from this data structure. tcaches starts off as a sparse 24*8e33eff8Schristos * array, so it has no physical memory footprint until individual pages are 25*8e33eff8Schristos * touched. This allows the entire array to be allocated the first time an 26*8e33eff8Schristos * explicit tcache is created without a disproportionate impact on memory usage. 27*8e33eff8Schristos */ 28*8e33eff8Schristos extern tcaches_t *tcaches; 29*8e33eff8Schristos 30*8e33eff8Schristos size_t tcache_salloc(tsdn_t *tsdn, const void *ptr); 31*8e33eff8Schristos void tcache_event_hard(tsd_t *tsd, tcache_t *tcache); 32*8e33eff8Schristos void *tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache, 33*8e33eff8Schristos cache_bin_t *tbin, szind_t binind, bool *tcache_success); 34*8e33eff8Schristos void tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin, 35*8e33eff8Schristos szind_t binind, unsigned rem); 36*8e33eff8Schristos void tcache_bin_flush_large(tsd_t *tsd, cache_bin_t *tbin, szind_t binind, 37*8e33eff8Schristos unsigned rem, tcache_t *tcache); 38*8e33eff8Schristos void tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache, 39*8e33eff8Schristos arena_t *arena); 40*8e33eff8Schristos tcache_t *tcache_create_explicit(tsd_t *tsd); 41*8e33eff8Schristos void tcache_cleanup(tsd_t *tsd); 42*8e33eff8Schristos void tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena); 43*8e33eff8Schristos bool tcaches_create(tsd_t *tsd, unsigned *r_ind); 44*8e33eff8Schristos void tcaches_flush(tsd_t *tsd, unsigned ind); 45*8e33eff8Schristos void tcaches_destroy(tsd_t *tsd, unsigned ind); 46*8e33eff8Schristos bool tcache_boot(tsdn_t *tsdn); 47*8e33eff8Schristos void tcache_arena_associate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena); 48*8e33eff8Schristos void tcache_prefork(tsdn_t *tsdn); 49*8e33eff8Schristos void tcache_postfork_parent(tsdn_t *tsdn); 50*8e33eff8Schristos void tcache_postfork_child(tsdn_t *tsdn); 51*8e33eff8Schristos void tcache_flush(tsd_t *tsd); 52*8e33eff8Schristos bool tsd_tcache_data_init(tsd_t *tsd); 53*8e33eff8Schristos bool tsd_tcache_enabled_data_init(tsd_t *tsd); 54*8e33eff8Schristos 55*8e33eff8Schristos #endif /* JEMALLOC_INTERNAL_TCACHE_EXTERNS_H */ 56