summaryrefslogtreecommitdiff
path: root/deps/jemalloc/include/jemalloc/internal/tcache_structs.h
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2023-05-15 13:08:15 +0300
committerGitHub <noreply@github.com>2023-05-15 13:08:15 +0300
commita51eb05b1895babb17c37c36b963e2bcbd5496d5 (patch)
tree7be24b09e0a5621a03e9f9ffe9ef27fcb44d8345 /deps/jemalloc/include/jemalloc/internal/tcache_structs.h
parente26a769d9627ebecb8607375580970a740348956 (diff)
parent986dbf716e0cb904c80bb444635cea3242859cc1 (diff)
downloadredis-a51eb05b1895babb17c37c36b963e2bcbd5496d5.tar.gz
Release Redis 7.2 RC27.2-rc27.2
Diffstat (limited to 'deps/jemalloc/include/jemalloc/internal/tcache_structs.h')
-rw-r--r--deps/jemalloc/include/jemalloc/internal/tcache_structs.h62
1 files changed, 30 insertions, 32 deletions
diff --git a/deps/jemalloc/include/jemalloc/internal/tcache_structs.h b/deps/jemalloc/include/jemalloc/internal/tcache_structs.h
index 172ef9040..176d73de9 100644
--- a/deps/jemalloc/include/jemalloc/internal/tcache_structs.h
+++ b/deps/jemalloc/include/jemalloc/internal/tcache_structs.h
@@ -7,36 +7,19 @@
#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;
+/*
+ * The tcache state is split into the slow and hot path data. Each has a
+ * pointer to the other, and the data always comes in pairs. The layout of each
+ * of them varies in practice; tcache_slow lives in the TSD for the automatic
+ * tcache, and as part of a dynamic allocation for manual allocations. Keeping
+ * a pointer to tcache_slow lets us treat these cases uniformly, rather than
+ * splitting up the tcache [de]allocation code into those paths called with the
+ * TSD tcache and those called with a manual tcache.
+ */
-struct tcache_s {
- /*
- * To minimize our cache-footprint, we put the frequently accessed data
- * together at the start of this struct.
- */
-
- /* Cleared after arena_prof_accum(). */
- uint64_t prof_accumbytes;
- /* Drives incremental GC. */
- ticker_t gc_ticker;
- /*
- * 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.
- */
- cache_bin_t bins_small[SC_NBINS];
-
- /*
- * This data is less hot; we can be a little less careful with our
- * footprint here.
- */
+struct tcache_slow_s {
/* Lets us track all the tcaches in an arena. */
- 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;
+ ql_elm(tcache_slow_t) link;
/*
* The descriptor lets the arena find our cache bins without seeing the
@@ -51,12 +34,27 @@ struct tcache_s {
szind_t next_gc_bin;
/* For small bins, fill (ncached_max >> lg_fill_div). */
uint8_t lg_fill_div[SC_NBINS];
+ /* For small bins, whether has been refilled since last GC. */
+ bool bin_refilled[SC_NBINS];
+ /*
+ * For small bins, the number of items we can pretend to flush before
+ * actually flushing.
+ */
+ uint8_t bin_flush_delay_items[SC_NBINS];
/*
- * 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
- * letting us avoid touching an extra page if we don't have to.
+ * The start of the allocation containing the dynamic allocation for
+ * either the cache bins alone, or the cache bin memory as well as this
+ * tcache_slow_t and its associated tcache_t.
*/
- cache_bin_t bins_large[SC_NSIZES-SC_NBINS];
+ void *dyn_alloc;
+
+ /* The associated bins. */
+ tcache_t *tcache;
+};
+
+struct tcache_s {
+ tcache_slow_t *tcache_slow;
+ cache_bin_t bins[TCACHE_NBINS_MAX];
};
/* Linkage for list of available (previously used) explicit tcache IDs. */