Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/jemalloc/include/jemalloc/internal/tcache_structs.h
#ifndef JEMALLOC_INTERNAL_TCACHE_STRUCTS_H | #ifndef JEMALLOC_INTERNAL_TCACHE_STRUCTS_H | ||||
#define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H | #define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H | ||||
#include "jemalloc/internal/ql.h" | |||||
#include "jemalloc/internal/size_classes.h" | |||||
#include "jemalloc/internal/cache_bin.h" | #include "jemalloc/internal/cache_bin.h" | ||||
#include "jemalloc/internal/ql.h" | |||||
#include "jemalloc/internal/sc.h" | |||||
#include "jemalloc/internal/ticker.h" | #include "jemalloc/internal/ticker.h" | ||||
#include "jemalloc/internal/tsd_types.h" | |||||
/* Various uses of this struct need it to be a named type. */ | |||||
typedef ql_elm(tsd_t) tsd_link_t; | |||||
struct tcache_s { | struct tcache_s { | ||||
/* | /* | ||||
* To minimize our cache-footprint, we put the frequently accessed data | * To minimize our cache-footprint, we put the frequently accessed data | ||||
* together at the start of this struct. | * together at the start of this struct. | ||||
*/ | */ | ||||
/* Cleared after arena_prof_accum(). */ | /* Cleared after arena_prof_accum(). */ | ||||
uint64_t prof_accumbytes; | uint64_t prof_accumbytes; | ||||
/* Drives incremental GC. */ | /* Drives incremental GC. */ | ||||
ticker_t gc_ticker; | ticker_t gc_ticker; | ||||
/* | /* | ||||
* The pointer stacks associated with bins follow as a contiguous array. | * The pointer stacks associated with bins follow as a contiguous array. | ||||
* During tcache initialization, the avail pointer in each element of | * During tcache initialization, the avail pointer in each element of | ||||
* tbins is initialized to point to the proper offset within this array. | * tbins is initialized to point to the proper offset within this array. | ||||
*/ | */ | ||||
cache_bin_t bins_small[NBINS]; | cache_bin_t bins_small[SC_NBINS]; | ||||
/* | /* | ||||
* This data is less hot; we can be a little less careful with our | * This data is less hot; we can be a little less careful with our | ||||
* footprint here. | * footprint here. | ||||
*/ | */ | ||||
/* Lets us track all the tcaches in an arena. */ | /* Lets us track all the tcaches in an arena. */ | ||||
ql_elm(tcache_t) link; | ql_elm(tcache_t) link; | ||||
/* Logically scoped to tsd, but put here for cache layout reasons. */ | |||||
ql_elm(tsd_t) tsd_link; | |||||
bool in_hook; | |||||
/* | /* | ||||
* The descriptor lets the arena find our cache bins without seeing the | * The descriptor lets the arena find our cache bins without seeing the | ||||
* tcache definition. This enables arenas to aggregate stats across | * tcache definition. This enables arenas to aggregate stats across | ||||
* tcaches without having a tcache dependency. | * tcaches without having a tcache dependency. | ||||
*/ | */ | ||||
cache_bin_array_descriptor_t cache_bin_array_descriptor; | cache_bin_array_descriptor_t cache_bin_array_descriptor; | ||||
/* The arena this tcache is associated with. */ | /* The arena this tcache is associated with. */ | ||||
arena_t *arena; | arena_t *arena; | ||||
/* Next bin to GC. */ | /* Next bin to GC. */ | ||||
szind_t next_gc_bin; | szind_t next_gc_bin; | ||||
/* For small bins, fill (ncached_max >> lg_fill_div). */ | /* For small bins, fill (ncached_max >> lg_fill_div). */ | ||||
uint8_t lg_fill_div[NBINS]; | uint8_t lg_fill_div[SC_NBINS]; | ||||
/* | /* | ||||
* We put the cache bins for large size classes at the end of the | * We put the cache bins for large size classes at the end of the | ||||
* struct, since some of them might not get used. This might end up | * struct, since some of them might not get used. This might end up | ||||
* letting us avoid touching an extra page if we don't have to. | * letting us avoid touching an extra page if we don't have to. | ||||
*/ | */ | ||||
cache_bin_t bins_large[NSIZES-NBINS]; | cache_bin_t bins_large[SC_NSIZES-SC_NBINS]; | ||||
}; | }; | ||||
/* Linkage for list of available (previously used) explicit tcache IDs. */ | /* Linkage for list of available (previously used) explicit tcache IDs. */ | ||||
struct tcaches_s { | struct tcaches_s { | ||||
union { | union { | ||||
tcache_t *tcache; | tcache_t *tcache; | ||||
tcaches_t *next; | tcaches_t *next; | ||||
}; | }; | ||||
}; | }; | ||||
#endif /* JEMALLOC_INTERNAL_TCACHE_STRUCTS_H */ | #endif /* JEMALLOC_INTERNAL_TCACHE_STRUCTS_H */ |