PA: Minor cleanups and comment fixes.

This commit is contained in:
David Goldblatt
2020-03-11 16:13:36 -07:00
committed by David Goldblatt
parent 46a9d7fc0b
commit c075fd0bcb
3 changed files with 38 additions and 15 deletions

View File

@@ -582,12 +582,14 @@ arena_decay_impl(tsdn_t *tsdn, arena_t *arena, decay_t *decay,
pa_shard_decay_stats_t *decay_stats, ecache_t *ecache,
bool is_background_thread, bool all) {
if (all) {
malloc_mutex_lock(tsdn, &decay->mtx);
pa_decay_all(tsdn, &arena->pa_shard, decay, decay_stats, ecache,
/* fully_decay */ all);
malloc_mutex_unlock(tsdn, &decay->mtx);
/*
* The previous pa_decay_to_limit call may not have actually
* decayed all pages, if new pages were added concurrently with
* the purge.
* The previous pa_decay_all call may not have actually decayed
* all pages, if new pages were added concurrently with the
* purge.
*
* I don't think we need an activity check for that case (some
* other thread must be deallocating, and they should do one),

View File

@@ -260,13 +260,12 @@ pa_decay_stashed(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
* stashed), otherwise unbounded new pages could be added to extents during the
* current decay run, so that the purging thread never finishes.
*/
void
static 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,
size_t npages_limit, size_t npages_decay_max) {
witness_assert_depth_to_rank(tsdn_witness_tsdp_get(tsdn),
WITNESS_RANK_CORE, 1);
malloc_mutex_assert_owner(tsdn, &decay->mtx);
if (decay->purging || npages_decay_max == 0) {
return;
@@ -291,10 +290,9 @@ pa_decay_to_limit(tsdn_t *tsdn, pa_shard_t *shard, decay_t *decay,
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);
malloc_mutex_assert_owner(tsdn, &decay->mtx);
pa_decay_to_limit(tsdn, shard, decay, decay_stats, ecache, fully_decay,
/* npages_limit */ 0, ecache_npages_get(ecache));
}
static void