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