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);
|
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,
|
bool extent_merge_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
||||||
edata_t *a, edata_t *b);
|
edata_t *a, edata_t *b);
|
||||||
|
size_t extent_sn_next(pac_t *pac);
|
||||||
bool extent_boot(void);
|
bool extent_boot(void);
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_EXTENT_H */
|
#endif /* JEMALLOC_INTERNAL_EXTENT_H */
|
||||||
|
@ -84,9 +84,6 @@ struct pa_shard_s {
|
|||||||
/* The source of edata_t objects. */
|
/* The source of edata_t objects. */
|
||||||
edata_cache_t edata_cache;
|
edata_cache_t edata_cache;
|
||||||
|
|
||||||
/* Extent serial number generator state. */
|
|
||||||
atomic_zu_t extent_sn_next;
|
|
||||||
|
|
||||||
malloc_mutex_t *stats_mtx;
|
malloc_mutex_t *stats_mtx;
|
||||||
pa_shard_stats_t *stats;
|
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);
|
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. */
|
/* Gets an edata for the given allocation. */
|
||||||
edata_t *pa_alloc(tsdn_t *tsdn, pa_shard_t *shard, size_t size,
|
edata_t *pa_alloc(tsdn_t *tsdn, pa_shard_t *shard, size_t size,
|
||||||
size_t alignment, bool slab, szind_t szind, bool zero);
|
size_t alignment, bool slab, szind_t szind, bool zero);
|
||||||
|
@ -90,6 +90,9 @@ struct pac_s {
|
|||||||
|
|
||||||
malloc_mutex_t *stats_mtx;
|
malloc_mutex_t *stats_mtx;
|
||||||
pac_stats_t *stats;
|
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,
|
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
|
static bool
|
||||||
extent_try_delayed_coalesce(tsdn_t *tsdn, pa_shard_t *shard,
|
extent_try_delayed_coalesce(tsdn_t *tsdn, pa_shard_t *shard,
|
||||||
ehooks_t *ehooks, ecache_t *ecache, edata_t *edata) {
|
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,
|
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_state_active, zeroed, committed, /* ranged */ false,
|
||||||
EXTENT_IS_HEAD);
|
EXTENT_IS_HEAD);
|
||||||
|
|
||||||
@ -793,7 +798,7 @@ extent_alloc_wrapper(tsdn_t *tsdn, pa_shard_t *shard, ehooks_t *ehooks,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
edata_init(edata, ecache_ind_get(&shard->pac.ecache_dirty), addr,
|
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_state_active, zero, *commit, /* ranged */ false,
|
||||||
EXTENT_NOT_HEAD);
|
EXTENT_NOT_HEAD);
|
||||||
if (extent_register(tsdn, shard, edata)) {
|
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) {
|
if (gap_size_page != 0) {
|
||||||
edata_init(gap, arena_ind_get(arena),
|
edata_init(gap, arena_ind_get(arena),
|
||||||
gap_addr_page, gap_size_page, false,
|
gap_addr_page, gap_size_page, false,
|
||||||
SC_NSIZES, pa_shard_extent_sn_next(
|
SC_NSIZES, extent_sn_next(
|
||||||
&arena->pa_shard), extent_state_active,
|
&arena->pa_shard.pac),
|
||||||
false, true, false, EXTENT_NOT_HEAD);
|
extent_state_active, false, true, false,
|
||||||
|
EXTENT_NOT_HEAD);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Compute the address just past the end of the desired
|
* 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_store_zu(&shard->extent_sn_next, 0, ATOMIC_RELAXED);
|
|
||||||
atomic_store_zu(&shard->nactive, 0, ATOMIC_RELAXED);
|
atomic_store_zu(&shard->nactive, 0, ATOMIC_RELAXED);
|
||||||
|
|
||||||
shard->stats_mtx = stats_mtx;
|
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
|
static bool
|
||||||
pa_shard_may_have_muzzy(pa_shard_t *shard) {
|
pa_shard_may_have_muzzy(pa_shard_t *shard) {
|
||||||
return pac_muzzy_decay_ms_get(&shard->pac) != 0;
|
return pac_muzzy_decay_ms_get(&shard->pac) != 0;
|
||||||
|
@ -49,6 +49,7 @@ pac_init(tsdn_t *tsdn, pac_t *pac, unsigned ind, emap_t *emap,
|
|||||||
pac->edata_cache = edata_cache;
|
pac->edata_cache = edata_cache;
|
||||||
pac->stats = pac_stats;
|
pac->stats = pac_stats;
|
||||||
pac->stats_mtx = stats_mtx;
|
pac->stats_mtx = stats_mtx;
|
||||||
|
atomic_store_zu(&pac->extent_sn_next, 0, ATOMIC_RELAXED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user