PA->PAC: Move in extent_sn.
This commit is contained in:
parent
7391382349
commit
dee5d1c42d
@ -48,7 +48,7 @@ edata_t *extent_split_wrapper(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
ehooks_t *ehooks, edata_t *edata, size_t size_a, size_t size_b);
|
||||
bool extent_merge_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
||||
edata_t *a, edata_t *b);
|
||||
|
||||
size_t extent_sn_next(pac_t *pac);
|
||||
bool extent_boot(void);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_EXTENT_H */
|
||||
|
@ -84,9 +84,6 @@ struct pa_shard_s {
|
||||
/* The source of edata_t objects. */
|
||||
edata_cache_t edata_cache;
|
||||
|
||||
/* Extent serial number generator state. */
|
||||
atomic_zu_t extent_sn_next;
|
||||
|
||||
malloc_mutex_t *stats_mtx;
|
||||
pa_shard_stats_t *stats;
|
||||
|
||||
@ -131,8 +128,6 @@ void pa_shard_reset(pa_shard_t *shard);
|
||||
*/
|
||||
void pa_shard_destroy_retained(tsdn_t *tsdn, pa_shard_t *shard);
|
||||
|
||||
size_t pa_shard_extent_sn_next(pa_shard_t *shard);
|
||||
|
||||
/* Gets an edata for the given allocation. */
|
||||
edata_t *pa_alloc(tsdn_t *tsdn, pa_shard_t *shard, size_t size,
|
||||
size_t alignment, bool slab, szind_t szind, bool zero);
|
||||
|
@ -90,6 +90,9 @@ struct pac_s {
|
||||
|
||||
malloc_mutex_t *stats_mtx;
|
||||
pac_stats_t *stats;
|
||||
|
||||
/* Extent serial number generator state. */
|
||||
atomic_zu_t extent_sn_next;
|
||||
};
|
||||
|
||||
bool pac_init(tsdn_t *tsdn, pac_t *pac, unsigned ind, emap_t *emap,
|
||||
|
@ -50,6 +50,11 @@ static edata_t *extent_alloc_retained(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
size_t
|
||||
extent_sn_next(pac_t *pac) {
|
||||
return atomic_fetch_add_zu(&pac->extent_sn_next, 1, ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static bool
|
||||
extent_try_delayed_coalesce(tsdn_t *tsdn, pa_shard_t *shard,
|
||||
ehooks_t *ehooks, ecache_t *ecache, edata_t *edata) {
|
||||
@ -648,7 +653,7 @@ extent_grow_retained(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
||||
}
|
||||
|
||||
edata_init(edata, ecache_ind_get(&shard->pac.ecache_retained), ptr,
|
||||
alloc_size, false, SC_NSIZES, pa_shard_extent_sn_next(shard),
|
||||
alloc_size, false, SC_NSIZES, extent_sn_next(&shard->pac),
|
||||
extent_state_active, zeroed, committed, /* ranged */ false,
|
||||
EXTENT_IS_HEAD);
|
||||
|
||||
@ -793,7 +798,7 @@ extent_alloc_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
||||
return NULL;
|
||||
}
|
||||
edata_init(edata, ecache_ind_get(&shard->pac.ecache_dirty), addr,
|
||||
size, /* slab */ false, SC_NSIZES, pa_shard_extent_sn_next(shard),
|
||||
size, /* slab */ false, SC_NSIZES, extent_sn_next(&shard->pac),
|
||||
extent_state_active, zero, *commit, /* ranged */ false,
|
||||
EXTENT_NOT_HEAD);
|
||||
if (extent_register(tsdn, shard, edata)) {
|
||||
|
@ -154,9 +154,10 @@ extent_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
|
||||
if (gap_size_page != 0) {
|
||||
edata_init(gap, arena_ind_get(arena),
|
||||
gap_addr_page, gap_size_page, false,
|
||||
SC_NSIZES, pa_shard_extent_sn_next(
|
||||
&arena->pa_shard), extent_state_active,
|
||||
false, true, false, EXTENT_NOT_HEAD);
|
||||
SC_NSIZES, extent_sn_next(
|
||||
&arena->pa_shard.pac),
|
||||
extent_state_active, false, true, false,
|
||||
EXTENT_NOT_HEAD);
|
||||
}
|
||||
/*
|
||||
* Compute the address just past the end of the desired
|
||||
|
6
src/pa.c
6
src/pa.c
@ -35,7 +35,6 @@ pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, emap_t *emap, base_t *base,
|
||||
return true;
|
||||
}
|
||||
|
||||
atomic_store_zu(&shard->extent_sn_next, 0, ATOMIC_RELAXED);
|
||||
atomic_store_zu(&shard->nactive, 0, ATOMIC_RELAXED);
|
||||
|
||||
shard->stats_mtx = stats_mtx;
|
||||
@ -79,11 +78,6 @@ pa_shard_destroy_retained(tsdn_t *tsdn, pa_shard_t *shard) {
|
||||
}
|
||||
}
|
||||
|
||||
size_t
|
||||
pa_shard_extent_sn_next(pa_shard_t *shard) {
|
||||
return atomic_fetch_add_zu(&shard->extent_sn_next, 1, ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
static bool
|
||||
pa_shard_may_have_muzzy(pa_shard_t *shard) {
|
||||
return pac_muzzy_decay_ms_get(&shard->pac) != 0;
|
||||
|
Loading…
Reference in New Issue
Block a user