Bail out early for muzzy decay.

This avoids taking the muzzy decay mutex with the default setting.
This commit is contained in:
Qi Wang 2019-11-06 23:09:20 -08:00 committed by Qi Wang
parent 73510dfd15
commit 04cb7d4d6b

View File

@ -919,7 +919,7 @@ arena_decay_to_limit(tsdn_t *tsdn, arena_t *arena, arena_decay_t *decay,
WITNESS_RANK_CORE, 1); WITNESS_RANK_CORE, 1);
malloc_mutex_assert_owner(tsdn, &decay->mtx); malloc_mutex_assert_owner(tsdn, &decay->mtx);
if (decay->purging) { if (decay->purging || npages_decay_max == 0) {
return; return;
} }
decay->purging = true; decay->purging = true;
@ -988,6 +988,10 @@ arena_decay_dirty(tsdn_t *tsdn, arena_t *arena, bool is_background_thread,
static bool static bool
arena_decay_muzzy(tsdn_t *tsdn, arena_t *arena, bool is_background_thread, arena_decay_muzzy(tsdn_t *tsdn, arena_t *arena, bool is_background_thread,
bool all) { bool all) {
if (eset_npages_get(&arena->eset_muzzy) == 0 &&
arena_muzzy_decay_ms_get(arena) <= 0) {
return false;
}
return arena_decay_impl(tsdn, arena, &arena->decay_muzzy, return arena_decay_impl(tsdn, arena, &arena->decay_muzzy,
&arena->eset_muzzy, is_background_thread, all); &arena->eset_muzzy, is_background_thread, all);
} }