Unify the signature of tcache_flush small and large.

This commit is contained in:
Qi Wang 2019-08-12 11:08:39 -07:00 committed by Qi Wang
parent 28ed9b9a51
commit 9c5c2a2c86
3 changed files with 10 additions and 9 deletions

View File

@ -31,8 +31,8 @@ void *tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,
cache_bin_t *tbin, szind_t binind, bool *tcache_success); cache_bin_t *tbin, szind_t binind, bool *tcache_success);
void tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin, void tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
szind_t binind, unsigned rem); szind_t binind, unsigned rem);
void tcache_bin_flush_large(tsd_t *tsd, cache_bin_t *tbin, szind_t binind, void tcache_bin_flush_large(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
unsigned rem, tcache_t *tcache); szind_t binind, unsigned rem);
void tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache, void tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache,
arena_t *arena); arena_t *arena);
tcache_t *tcache_create_explicit(tsd_t *tsd); tcache_t *tcache_create_explicit(tsd_t *tsd);

View File

@ -202,8 +202,8 @@ tcache_dalloc_large(tsd_t *tsd, tcache_t *tcache, void *ptr, szind_t binind,
bin = tcache_large_bin_get(tcache, binind); bin = tcache_large_bin_get(tcache, binind);
bin_info = &tcache_bin_info[binind]; bin_info = &tcache_bin_info[binind];
if (unlikely(bin->ncached == bin_info->ncached_max)) { if (unlikely(bin->ncached == bin_info->ncached_max)) {
tcache_bin_flush_large(tsd, bin, binind, tcache_bin_flush_large(tsd, tcache, bin, binind,
(bin_info->ncached_max >> 1), tcache); (bin_info->ncached_max >> 1));
} }
assert(bin->ncached < bin_info->ncached_max); assert(bin->ncached < bin_info->ncached_max);
bin->ncached++; bin->ncached++;

View File

@ -65,8 +65,9 @@ tcache_event_hard(tsd_t *tsd, tcache_t *tcache) {
tcache->lg_fill_div[binind]++; tcache->lg_fill_div[binind]++;
} }
} else { } else {
tcache_bin_flush_large(tsd, tbin, binind, tbin->ncached tcache_bin_flush_large(tsd, tcache, tbin, binind,
- tbin->low_water + (tbin->low_water >> 2), tcache); tbin->ncached - tbin->low_water + (tbin->low_water
>> 2));
} }
} else if (tbin->low_water < 0) { } else if (tbin->low_water < 0) {
/* /*
@ -227,8 +228,8 @@ tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
} }
void void
tcache_bin_flush_large(tsd_t *tsd, cache_bin_t *tbin, szind_t binind, tcache_bin_flush_large(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin, szind_t binind,
unsigned rem, tcache_t *tcache) { unsigned rem) {
bool merged_stats = false; bool merged_stats = false;
assert(binind < nhbins); assert(binind < nhbins);
@ -522,7 +523,7 @@ tcache_flush_cache(tsd_t *tsd, tcache_t *tcache) {
} }
for (unsigned i = SC_NBINS; i < nhbins; i++) { for (unsigned i = SC_NBINS; i < nhbins; i++) {
cache_bin_t *tbin = tcache_large_bin_get(tcache, i); cache_bin_t *tbin = tcache_large_bin_get(tcache, i);
tcache_bin_flush_large(tsd, tbin, i, 0, tcache); tcache_bin_flush_large(tsd, tcache, tbin, i, 0);
if (config_stats) { if (config_stats) {
assert(tbin->tstats.nrequests == 0); assert(tbin->tstats.nrequests == 0);