1 #ifndef JEMALLOC_INTERNAL_TCACHE_STRUCTS_H 2 #define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H 3 4 typedef enum { 5 tcache_enabled_false = 0, /* Enable cast to/from bool. */ 6 tcache_enabled_true = 1, 7 tcache_enabled_default = 2 8 } tcache_enabled_t; 9 10 /* 11 * Read-only information associated with each element of tcache_t's tbins array 12 * is stored separately, mainly to reduce memory usage. 13 */ 14 struct tcache_bin_info_s { 15 unsigned ncached_max; /* Upper limit on ncached. */ 16 }; 17 18 struct tcache_bin_s { 19 tcache_bin_stats_t tstats; 20 int low_water; /* Min # cached since last GC. */ 21 unsigned lg_fill_div; /* Fill (ncached_max >> lg_fill_div). */ 22 unsigned ncached; /* # of cached objects. */ 23 /* 24 * To make use of adjacent cacheline prefetch, the items in the avail 25 * stack goes to higher address for newer allocations. avail points 26 * just above the available space, which means that 27 * avail[-ncached, ... -1] are available items and the lowest item will 28 * be allocated first. 29 */ 30 void **avail; /* Stack of available objects. */ 31 }; 32 33 struct tcache_s { 34 ql_elm(tcache_t) link; /* Used for aggregating stats. */ 35 uint64_t prof_accumbytes;/* Cleared after arena_prof_accum(). */ 36 ticker_t gc_ticker; /* Drives incremental GC. */ 37 szind_t next_gc_bin; /* Next bin to GC. */ 38 tcache_bin_t tbins[1]; /* Dynamically sized. */ 39 /* 40 * The pointer stacks associated with tbins follow as a contiguous 41 * array. During tcache initialization, the avail pointer in each 42 * element of tbins is initialized to point to the proper offset within 43 * this array. 44 */ 45 }; 46 47 /* Linkage for list of available (previously used) explicit tcache IDs. */ 48 struct tcaches_s { 49 union { 50 tcache_t *tcache; 51 tcaches_t *next; 52 }; 53 }; 54 55 #endif /* JEMALLOC_INTERNAL_TCACHE_STRUCTS_H */ 56