diff --git a/include/jemalloc/internal/hpa.h b/include/jemalloc/internal/hpa.h index 1f90a15f..d788d051 100644 --- a/include/jemalloc/internal/hpa.h +++ b/include/jemalloc/internal/hpa.h @@ -31,8 +31,6 @@ struct hpa_central_s { size_t eden_len; /* Source for metadata. */ base_t *base; - /* Number of grow operations done on this hpa_central_t. */ - uint64_t age_counter; /* The HPA hooks. */ hpa_hooks_t hooks; diff --git a/src/hpa.c b/src/hpa.c index cb3f978c..932cf201 100644 --- a/src/hpa.c +++ b/src/hpa.c @@ -82,7 +82,6 @@ hpa_central_init(hpa_central_t *central, base_t *base, const hpa_hooks_t *hooks) central->base = base; central->eden = NULL; central->eden_len = 0; - central->age_counter = 0; central->hooks = *hooks; return false; } @@ -95,7 +94,7 @@ hpa_alloc_ps(tsdn_t *tsdn, hpa_central_t *central) { static hpdata_t * hpa_central_extract(tsdn_t *tsdn, hpa_central_t *central, size_t size, - bool *oom) { + uint64_t age, bool *oom) { /* Don't yet support big allocations; these should get filtered out. */ assert(size <= HUGEPAGE); /* @@ -118,7 +117,7 @@ hpa_central_extract(tsdn_t *tsdn, hpa_central_t *central, size_t size, malloc_mutex_unlock(tsdn, ¢ral->grow_mtx); return NULL; } - hpdata_init(ps, central->eden, central->age_counter++); + hpdata_init(ps, central->eden, age); central->eden = NULL; central->eden_len = 0; malloc_mutex_unlock(tsdn, ¢ral->grow_mtx); @@ -168,7 +167,7 @@ hpa_central_extract(tsdn_t *tsdn, hpa_central_t *central, size_t size, assert(central->eden_len % HUGEPAGE == 0); assert(HUGEPAGE_ADDR2BASE(central->eden) == central->eden); - hpdata_init(ps, central->eden, central->age_counter++); + hpdata_init(ps, central->eden, age); char *eden_char = (char *)central->eden; eden_char += HUGEPAGE; @@ -738,7 +737,8 @@ hpa_alloc_batch_psset(tsdn_t *tsdn, hpa_shard_t *shard, size_t size, * deallocations (and allocations of smaller sizes) may still succeed * while we're doing this potentially expensive system call. */ - hpdata_t *ps = hpa_central_extract(tsdn, shard->central, size, &oom); + hpdata_t *ps = hpa_central_extract(tsdn, shard->central, size, + shard->age_counter++, &oom); if (ps == NULL) { malloc_mutex_unlock(tsdn, &shard->grow_mtx); return nsuccess;