diff --git a/include/jemalloc/internal/pa.h b/include/jemalloc/internal/pa.h index 655e46b4..827c0b5e 100644 --- a/include/jemalloc/internal/pa.h +++ b/include/jemalloc/internal/pa.h @@ -1,6 +1,7 @@ #ifndef JEMALLOC_INTERNAL_PA_H #define JEMALLOC_INTERNAL_PA_H +#include "jemalloc/internal/base.h" #include "jemalloc/internal/decay.h" #include "jemalloc/internal/ecache.h" #include "jemalloc/internal/edata_cache.h" @@ -80,6 +81,9 @@ struct pa_shard_s { */ decay_t decay_dirty; /* dirty --> muzzy */ decay_t decay_muzzy; /* muzzy --> retained */ + + /* The base from which we get the ehooks and allocate metadat. */ + base_t *base; }; static inline void @@ -105,6 +109,11 @@ pa_shard_may_force_decay(pa_shard_t *shard) { || pa_shard_muzzy_decay_ms_get(shard) == -1); } +static inline ehooks_t * +pa_shard_ehooks_get(pa_shard_t *shard) { + return base_ehooks_get(shard->base); +} + /* Returns true on error. */ bool pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind, pa_shard_stats_t *stats, malloc_mutex_t *stats_mtx); diff --git a/src/pa.c b/src/pa.c index e4dbb040..a4ec4bd0 100644 --- a/src/pa.c +++ b/src/pa.c @@ -48,6 +48,8 @@ pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind, shard->stats = stats; memset(shard->stats, 0, sizeof(*shard->stats)); + shard->base = base; + return false; }