Add a per-arena oversize_threshold.

This can let manual arenas trade off memory and CPU the way auto arenas do.
This commit is contained in:
David Goldblatt 2020-11-11 13:34:43 -08:00 committed by David Goldblatt
parent 4ca3d91e96
commit cf2549a149
10 changed files with 194 additions and 12 deletions

View file

@ -983,8 +983,9 @@ extent_record(tsdn_t *tsdn, pac_t *pac, ehooks_t *ehooks,
edata = extent_try_coalesce_large(tsdn, pac, ehooks,
ecache, edata, &coalesced, growing_retained);
} while (coalesced);
if (edata_size_get(edata) >= oversize_threshold &&
extent_may_force_decay(pac)) {
if (edata_size_get(edata) >=
atomic_load_zu(&pac->oversize_threshold, ATOMIC_RELAXED)
&& extent_may_force_decay(pac)) {
/* Shortcut to purge the oversize extent eagerly. */
malloc_mutex_unlock(tsdn, &ecache->mtx);
extent_maximally_purge(tsdn, pac, ehooks, edata);