PA -> PAC: Move in decay_purge enum.

This commit is contained in:
David Goldblatt 2020-06-02 12:45:39 -07:00 committed by David Goldblatt
parent 72435b0aba
commit 4ee75be3a3
5 changed files with 18 additions and 18 deletions

View File

@ -18,13 +18,6 @@
* others will be coming soon.
*/
enum pa_decay_purge_setting_e {
PA_DECAY_PURGE_ALWAYS,
PA_DECAY_PURGE_NEVER,
PA_DECAY_PURGE_ON_EPOCH_ADVANCE
};
typedef enum pa_decay_purge_setting_e pa_decay_purge_setting_t;
/*
* The stats for a particular pa_shard. Because of the way the ctl module
* handles stats epoch data collection (it has its own arena_stats, and merges
@ -163,7 +156,7 @@ void pa_decay_all(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
*/
bool pa_maybe_decay_purge(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
pac_decay_stats_t *decay_stats, ecache_t *ecache,
pa_decay_purge_setting_t decay_purge_setting);
pac_decay_purge_setting_t decay_purge_setting);
/*
* Gets / sets the maximum amount that we'll grow an arena down the

View File

@ -9,6 +9,14 @@
* - Can use efficient OS-level zeroing primitives for demand-filled pages.
*/
/* How "eager" decay/purging should be. */
enum pac_decay_purge_setting_e {
PAC_DECAY_PURGE_ALWAYS,
PAC_DECAY_PURGE_NEVER,
PAC_DECAY_PURGE_ON_EPOCH_ADVANCE
};
typedef enum pac_decay_purge_setting_e pac_decay_purge_setting_t;
typedef struct pac_decay_stats_s pac_decay_stats_t;
struct pac_decay_stats_s {
/* Total number of purge sweeps. */

View File

@ -410,14 +410,14 @@ arena_muzzy_decay_ms_get(arena_t *arena) {
* specifically requested it), should we purge ourselves, or wait for the
* background thread to get to it.
*/
static pa_decay_purge_setting_t
static pac_decay_purge_setting_t
arena_decide_unforced_decay_purge_setting(bool is_background_thread) {
if (is_background_thread) {
return PA_DECAY_PURGE_ALWAYS;
return PAC_DECAY_PURGE_ALWAYS;
} else if (!is_background_thread && background_thread_enabled()) {
return PA_DECAY_PURGE_NEVER;
return PAC_DECAY_PURGE_NEVER;
} else {
return PA_DECAY_PURGE_ON_EPOCH_ADVANCE;
return PAC_DECAY_PURGE_ON_EPOCH_ADVANCE;
}
}
@ -440,7 +440,7 @@ arena_decay_ms_set(tsdn_t *tsdn, arena_t *arena, decay_t *decay,
nstime_t cur_time;
nstime_init_update(&cur_time);
decay_reinit(decay, &cur_time, decay_ms);
pa_decay_purge_setting_t decay_purge =
pac_decay_purge_setting_t decay_purge =
arena_decide_unforced_decay_purge_setting(
/* is_background_thread */ false);
pa_maybe_decay_purge(tsdn, &arena->pa_shard, decay, decay_stats, ecache,
@ -497,7 +497,7 @@ arena_decay_impl(tsdn_t *tsdn, arena_t *arena, decay_t *decay,
/* No need to wait if another thread is in progress. */
return true;
}
pa_decay_purge_setting_t decay_purge =
pac_decay_purge_setting_t decay_purge =
arena_decide_unforced_decay_purge_setting(is_background_thread);
bool epoch_advanced = pa_maybe_decay_purge(tsdn, &arena->pa_shard,
decay, decay_stats, ecache, decay_purge);

View File

@ -403,7 +403,7 @@ pa_decay_try_purge(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
bool
pa_maybe_decay_purge(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
pac_decay_stats_t *decay_stats, ecache_t *ecache,
pa_decay_purge_setting_t decay_purge_setting) {
pac_decay_purge_setting_t decay_purge_setting) {
malloc_mutex_assert_owner(tsdn, &decay->mtx);
/* Purge all or nothing if the option is disabled. */
@ -429,9 +429,9 @@ pa_maybe_decay_purge(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
size_t npages_current = ecache_npages_get(ecache);
bool epoch_advanced = decay_maybe_advance_epoch(decay, &time,
npages_current);
if (decay_purge_setting == PA_DECAY_PURGE_ALWAYS
if (decay_purge_setting == PAC_DECAY_PURGE_ALWAYS
|| (epoch_advanced && decay_purge_setting
== PA_DECAY_PURGE_ON_EPOCH_ADVANCE)) {
== PAC_DECAY_PURGE_ON_EPOCH_ADVANCE)) {
size_t npages_limit = decay_npages_limit_get(decay);
pa_decay_try_purge(tsdn, shard, decay, decay_stats, ecache,
npages_current, npages_limit);

View File

@ -76,4 +76,3 @@ pac_retain_grow_limit_get_set(tsdn_t *tsdn, pac_t *pac, size_t *old_limit,
return false;
}