PA: Move in decay-all pathway.
This commit is contained in:
parent
65698b7f2e
commit
2d6eec7b5c
@ -144,5 +144,7 @@ void pa_dalloc(tsdn_t *tsdn, pa_shard_t *shard, edata_t *edata,
|
|||||||
void pa_decay_to_limit(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
|
void pa_decay_to_limit(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
|
||||||
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache, bool fully_decay,
|
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache, bool fully_decay,
|
||||||
size_t npages_limit, size_t npages_decay_max);
|
size_t npages_limit, size_t npages_decay_max);
|
||||||
|
void pa_decay_all(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
|
||||||
|
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache, bool fully_decay);
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_PA_H */
|
#endif /* JEMALLOC_INTERNAL_PA_H */
|
||||||
|
10
src/arena.c
10
src/arena.c
@ -612,12 +612,8 @@ arena_decay_impl(tsdn_t *tsdn, arena_t *arena, decay_t *decay,
|
|||||||
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache,
|
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache,
|
||||||
bool is_background_thread, bool all) {
|
bool is_background_thread, bool all) {
|
||||||
if (all) {
|
if (all) {
|
||||||
assert(!is_background_thread);
|
pa_decay_all(tsdn, &arena->pa_shard, decay, decay_stats, ecache,
|
||||||
malloc_mutex_lock(tsdn, &decay->mtx);
|
/* fully_decay */ all);
|
||||||
pa_decay_to_limit(tsdn, &arena->pa_shard, decay, decay_stats,
|
|
||||||
ecache, /* fully_decay */ all, 0,
|
|
||||||
ecache_npages_get(ecache));
|
|
||||||
malloc_mutex_unlock(tsdn, &decay->mtx);
|
|
||||||
/*
|
/*
|
||||||
* The previous pa_decay_to_limit call may not have actually
|
* The previous pa_decay_to_limit call may not have actually
|
||||||
* decayed all pages, if new pages were added concurrently with
|
* decayed all pages, if new pages were added concurrently with
|
||||||
@ -630,9 +626,9 @@ arena_decay_impl(tsdn_t *tsdn, arena_t *arena, decay_t *decay,
|
|||||||
* an extra redundant check minimizes the change. We should
|
* an extra redundant check minimizes the change. We should
|
||||||
* reevaluate.
|
* reevaluate.
|
||||||
*/
|
*/
|
||||||
|
assert(!is_background_thread);
|
||||||
arena_background_thread_inactivity_check(tsdn, arena,
|
arena_background_thread_inactivity_check(tsdn, arena,
|
||||||
/* is_background_thread */ false);
|
/* is_background_thread */ false);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/pa.c
9
src/pa.c
@ -287,3 +287,12 @@ pa_decay_to_limit(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
|
|||||||
malloc_mutex_lock(tsdn, &decay->mtx);
|
malloc_mutex_lock(tsdn, &decay->mtx);
|
||||||
decay->purging = false;
|
decay->purging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pa_decay_all(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
|
||||||
|
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache, bool fully_decay) {
|
||||||
|
malloc_mutex_lock(tsdn, &decay->mtx);
|
||||||
|
pa_decay_to_limit(tsdn, shard, decay, decay_stats, ecache,
|
||||||
|
fully_decay, 0, ecache_npages_get(ecache));
|
||||||
|
malloc_mutex_unlock(tsdn, &decay->mtx);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user