Allow a range for the nfill passed to arena_cache_bin_fill_small

This commit is contained in:
Shirui Cheng
2024-08-01 10:24:09 -07:00
committed by Qi Wang
parent f68effe4ac
commit 14d5dc136a
3 changed files with 25 additions and 13 deletions

View File

@@ -254,7 +254,9 @@ tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena,
if (nfill == 0) {
nfill = 1;
}
arena_cache_bin_fill_small(tsdn, arena, cache_bin, binind, nfill);
arena_cache_bin_fill_small(tsdn, arena, cache_bin, binind,
/* nfill_min */ opt_experimental_tcache_gc ?
((nfill >> 1) + 1) : nfill, /* nfill_max */ nfill);
tcache_slow->bin_refilled[binind] = true;
ret = cache_bin_alloc(cache_bin, tcache_success);