PA: Add ehook-getting support.

This commit is contained in:
David Goldblatt 2020-03-10 12:04:16 -07:00 committed by David Goldblatt
parent eba35e2e48
commit 7624043a41
2 changed files with 11 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}