PAC: Move in decay.
This commit is contained in:
committed by
David Goldblatt
parent
c81e389996
commit
db211eefbf
@@ -131,9 +131,6 @@ arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks) {
|
||||
|
||||
JEMALLOC_ALWAYS_INLINE void
|
||||
arena_decay_tick(tsdn_t *tsdn, arena_t *arena) {
|
||||
malloc_mutex_assert_not_owner(tsdn, &arena->pa_shard.decay_dirty.mtx);
|
||||
malloc_mutex_assert_not_owner(tsdn, &arena->pa_shard.decay_muzzy.mtx);
|
||||
|
||||
arena_decay_ticks(tsdn, arena, 1);
|
||||
}
|
||||
|
||||
|
@@ -55,7 +55,7 @@ arena_background_thread_inactivity_check(tsdn_t *tsdn, arena_t *arena,
|
||||
arena_background_thread_info_get(arena);
|
||||
if (background_thread_indefinite_sleep(info)) {
|
||||
background_thread_interval_check(tsdn, arena,
|
||||
&arena->pa_shard.decay_dirty, 0);
|
||||
&arena->pa_shard.pac.decay_dirty, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -126,22 +126,12 @@ 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;
|
||||
|
||||
/*
|
||||
* Decay-based purging state, responsible for scheduling extent state
|
||||
* transitions.
|
||||
*
|
||||
* Synchronization: via the internal mutex.
|
||||
*/
|
||||
decay_t decay_dirty; /* dirty --> muzzy */
|
||||
decay_t decay_muzzy; /* muzzy --> retained */
|
||||
|
||||
/* The emap this shard is tied to. */
|
||||
emap_t *emap;
|
||||
|
||||
@@ -149,25 +139,16 @@ struct pa_shard_s {
|
||||
base_t *base;
|
||||
};
|
||||
|
||||
static inline ssize_t
|
||||
pa_shard_dirty_decay_ms_get(pa_shard_t *shard) {
|
||||
return decay_ms_read(&shard->decay_dirty);
|
||||
}
|
||||
static inline ssize_t
|
||||
pa_shard_muzzy_decay_ms_get(pa_shard_t *shard) {
|
||||
return decay_ms_read(&shard->decay_muzzy);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
pa_shard_dont_decay_muzzy(pa_shard_t *shard) {
|
||||
return ecache_npages_get(&shard->pac.ecache_muzzy) == 0 &&
|
||||
pa_shard_muzzy_decay_ms_get(shard) <= 0;
|
||||
pac_muzzy_decay_ms_get(&shard->pac) <= 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
pa_shard_may_force_decay(pa_shard_t *shard) {
|
||||
return !(pa_shard_dirty_decay_ms_get(shard) == -1
|
||||
|| pa_shard_muzzy_decay_ms_get(shard) == -1);
|
||||
return !(pac_dirty_decay_ms_get(&shard->pac) == -1
|
||||
|| pac_muzzy_decay_ms_get(&shard->pac) == -1);
|
||||
}
|
||||
|
||||
static inline ehooks_t *
|
||||
|
@@ -26,11 +26,31 @@ struct pac_s {
|
||||
|
||||
/* The grow info for the retained ecache. */
|
||||
ecache_grow_t ecache_grow;
|
||||
|
||||
/*
|
||||
* Decay-based purging state, responsible for scheduling extent state
|
||||
* transitions.
|
||||
*
|
||||
* Synchronization: via the internal mutex.
|
||||
*/
|
||||
decay_t decay_dirty; /* dirty --> muzzy */
|
||||
decay_t decay_muzzy; /* muzzy --> retained */
|
||||
};
|
||||
|
||||
bool pac_init(tsdn_t *tsdn, pac_t *pac, unsigned ind, emap_t *emap,
|
||||
edata_cache_t *edata_cache);
|
||||
edata_cache_t *edata_cache, nstime_t *cur_time, ssize_t dirty_decay_ms,
|
||||
ssize_t muzzy_decay_ms);
|
||||
bool pac_retain_grow_limit_get_set(tsdn_t *tsdn, pac_t *pac, size_t *old_limit,
|
||||
size_t *new_limit);
|
||||
|
||||
static inline ssize_t
|
||||
pac_dirty_decay_ms_get(pac_t *pac) {
|
||||
return decay_ms_read(&pac->decay_dirty);
|
||||
}
|
||||
|
||||
static inline ssize_t
|
||||
pac_muzzy_decay_ms_get(pac_t *pac) {
|
||||
return decay_ms_read(&pac->decay_muzzy);
|
||||
}
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_PAC_H */
|
||||
|
Reference in New Issue
Block a user