2017-01-11 10:06:31 +08:00
|
|
|
#ifndef JEMALLOC_INTERNAL_TCACHE_STRUCTS_H
|
|
|
|
#define JEMALLOC_INTERNAL_TCACHE_STRUCTS_H
|
|
|
|
|
2017-04-11 08:11:33 +08:00
|
|
|
#include "jemalloc/internal/ql.h"
|
2017-04-20 06:09:01 +08:00
|
|
|
#include "jemalloc/internal/size_classes.h"
|
2017-08-11 05:27:58 +08:00
|
|
|
#include "jemalloc/internal/cache_bin.h"
|
2017-04-20 04:39:33 +08:00
|
|
|
#include "jemalloc/internal/ticker.h"
|
2017-04-11 08:11:33 +08:00
|
|
|
|
2017-01-11 10:06:31 +08:00
|
|
|
struct tcache_s {
|
2017-04-07 03:35:22 +08:00
|
|
|
/* Data accessed frequently first: prof, ticker and small bins. */
|
2017-01-11 10:06:31 +08:00
|
|
|
uint64_t prof_accumbytes;/* Cleared after arena_prof_accum(). */
|
|
|
|
ticker_t gc_ticker; /* Drives incremental GC. */
|
|
|
|
/*
|
2017-08-11 05:27:58 +08:00
|
|
|
* The pointer stacks associated with bins follow as a contiguous array.
|
|
|
|
* During tcache initialization, the avail pointer in each element of
|
|
|
|
* tbins is initialized to point to the proper offset within this array.
|
2017-01-11 10:06:31 +08:00
|
|
|
*/
|
2017-08-11 05:27:58 +08:00
|
|
|
cache_bin_t bins_small[NBINS];
|
2017-04-07 03:35:22 +08:00
|
|
|
/* Data accessed less often below. */
|
|
|
|
ql_elm(tcache_t) link; /* Used for aggregating stats. */
|
|
|
|
arena_t *arena; /* Associated arena. */
|
|
|
|
szind_t next_gc_bin; /* Next bin to GC. */
|
|
|
|
/* For small bins, fill (ncached_max >> lg_fill_div). */
|
|
|
|
uint8_t lg_fill_div[NBINS];
|
2017-08-11 05:27:58 +08:00
|
|
|
cache_bin_t bins_large[NSIZES-NBINS];
|
2017-01-11 10:06:31 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Linkage for list of available (previously used) explicit tcache IDs. */
|
|
|
|
struct tcaches_s {
|
|
|
|
union {
|
|
|
|
tcache_t *tcache;
|
|
|
|
tcaches_t *next;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* JEMALLOC_INTERNAL_TCACHE_STRUCTS_H */
|