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