1*8e33eff8Schristos #ifndef JEMALLOC_INTERNAL_TCACHE_STRUCTS_H 2*8e33eff8Schristos #define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H 3*8e33eff8Schristos 4*8e33eff8Schristos #include "jemalloc/internal/ql.h" 5*8e33eff8Schristos #include "jemalloc/internal/size_classes.h" 6*8e33eff8Schristos #include "jemalloc/internal/cache_bin.h" 7*8e33eff8Schristos #include "jemalloc/internal/ticker.h" 8*8e33eff8Schristos 9*8e33eff8Schristos struct tcache_s { 10*8e33eff8Schristos /* 11*8e33eff8Schristos * To minimize our cache-footprint, we put the frequently accessed data 12*8e33eff8Schristos * together at the start of this struct. 13*8e33eff8Schristos */ 14*8e33eff8Schristos 15*8e33eff8Schristos /* Cleared after arena_prof_accum(). */ 16*8e33eff8Schristos uint64_t prof_accumbytes; 17*8e33eff8Schristos /* Drives incremental GC. */ 18*8e33eff8Schristos ticker_t gc_ticker; 19*8e33eff8Schristos /* 20*8e33eff8Schristos * The pointer stacks associated with bins follow as a contiguous array. 21*8e33eff8Schristos * During tcache initialization, the avail pointer in each element of 22*8e33eff8Schristos * tbins is initialized to point to the proper offset within this array. 23*8e33eff8Schristos */ 24*8e33eff8Schristos cache_bin_t bins_small[NBINS]; 25*8e33eff8Schristos 26*8e33eff8Schristos /* 27*8e33eff8Schristos * This data is less hot; we can be a little less careful with our 28*8e33eff8Schristos * footprint here. 29*8e33eff8Schristos */ 30*8e33eff8Schristos /* Lets us track all the tcaches in an arena. */ 31*8e33eff8Schristos ql_elm(tcache_t) link; 32*8e33eff8Schristos /* 33*8e33eff8Schristos * The descriptor lets the arena find our cache bins without seeing the 34*8e33eff8Schristos * tcache definition. This enables arenas to aggregate stats across 35*8e33eff8Schristos * tcaches without having a tcache dependency. 36*8e33eff8Schristos */ 37*8e33eff8Schristos cache_bin_array_descriptor_t cache_bin_array_descriptor; 38*8e33eff8Schristos 39*8e33eff8Schristos /* The arena this tcache is associated with. */ 40*8e33eff8Schristos arena_t *arena; 41*8e33eff8Schristos /* Next bin to GC. */ 42*8e33eff8Schristos szind_t next_gc_bin; 43*8e33eff8Schristos /* For small bins, fill (ncached_max >> lg_fill_div). */ 44*8e33eff8Schristos uint8_t lg_fill_div[NBINS]; 45*8e33eff8Schristos /* 46*8e33eff8Schristos * We put the cache bins for large size classes at the end of the 47*8e33eff8Schristos * struct, since some of them might not get used. This might end up 48*8e33eff8Schristos * letting us avoid touching an extra page if we don't have to. 49*8e33eff8Schristos */ 50*8e33eff8Schristos cache_bin_t bins_large[NSIZES-NBINS]; 51*8e33eff8Schristos }; 52*8e33eff8Schristos 53*8e33eff8Schristos /* Linkage for list of available (previously used) explicit tcache IDs. */ 54*8e33eff8Schristos struct tcaches_s { 55*8e33eff8Schristos union { 56*8e33eff8Schristos tcache_t *tcache; 57*8e33eff8Schristos tcaches_t *next; 58*8e33eff8Schristos }; 59*8e33eff8Schristos }; 60*8e33eff8Schristos 61*8e33eff8Schristos #endif /* JEMALLOC_INTERNAL_TCACHE_STRUCTS_H */ 62