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