PA: Move in decay initialization.
This commit is contained in:
parent
45671e4a27
commit
faec7219b2
@ -172,7 +172,8 @@ pa_shard_ehooks_get(pa_shard_t *shard) {
|
|||||||
|
|
||||||
/* Returns true on error. */
|
/* Returns true on error. */
|
||||||
bool pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind,
|
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);
|
pa_shard_stats_t *stats, malloc_mutex_t *stats_mtx, nstime_t *cur_time,
|
||||||
|
ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms);
|
||||||
/*
|
/*
|
||||||
* This does the PA-specific parts of arena reset (i.e. freeing all active
|
* This does the PA-specific parts of arena reset (i.e. freeing all active
|
||||||
* allocations).
|
* allocations).
|
||||||
|
14
src/arena.c
14
src/arena.c
@ -1487,19 +1487,11 @@ arena_new(tsdn_t *tsdn, unsigned ind, extent_hooks_t *extent_hooks) {
|
|||||||
goto label_error;
|
goto label_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pa_shard_init(tsdn, &arena->pa_shard, base, ind,
|
|
||||||
&arena->stats.pa_shard_stats, LOCKEDINT_MTX(arena->stats.mtx))) {
|
|
||||||
goto label_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
nstime_t cur_time;
|
nstime_t cur_time;
|
||||||
nstime_init_update(&cur_time);
|
nstime_init_update(&cur_time);
|
||||||
|
if (pa_shard_init(tsdn, &arena->pa_shard, base, ind,
|
||||||
if (decay_init(&arena->pa_shard.decay_dirty, &cur_time,
|
&arena->stats.pa_shard_stats, LOCKEDINT_MTX(arena->stats.mtx),
|
||||||
arena_dirty_decay_ms_default_get())) {
|
&cur_time, arena_dirty_decay_ms_default_get(),
|
||||||
goto label_error;
|
|
||||||
}
|
|
||||||
if (decay_init(&arena->pa_shard.decay_muzzy, &cur_time,
|
|
||||||
arena_muzzy_decay_ms_default_get())) {
|
arena_muzzy_decay_ms_default_get())) {
|
||||||
goto label_error;
|
goto label_error;
|
||||||
}
|
}
|
||||||
|
10
src/pa.c
10
src/pa.c
@ -14,7 +14,8 @@ pa_nactive_sub(pa_shard_t *shard, size_t sub_pages) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind,
|
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) {
|
pa_shard_stats_t *stats, malloc_mutex_t *stats_mtx, nstime_t *cur_time,
|
||||||
|
ssize_t dirty_decay_ms, ssize_t muzzy_decay_ms) {
|
||||||
/* This will change eventually, but for now it should hold. */
|
/* This will change eventually, but for now it should hold. */
|
||||||
assert(base_ind_get(base) == ind);
|
assert(base_ind_get(base) == ind);
|
||||||
/*
|
/*
|
||||||
@ -53,6 +54,13 @@ pa_shard_init(tsdn_t *tsdn, pa_shard_t *shard, base_t *base, unsigned ind,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (decay_init(&shard->decay_dirty, cur_time, dirty_decay_ms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (decay_init(&shard->decay_muzzy, cur_time, muzzy_decay_ms)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
atomic_store_zu(&shard->extent_sn_next, 0, ATOMIC_RELAXED);
|
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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user