Cache bin: simplify names and argument ordering.

We always start with the cache bin, then its info (if necessary).
This commit is contained in:
David Goldblatt
2020-02-28 19:12:07 -08:00
committed by David Goldblatt
parent e1dcc557d6
commit ff6acc6ed5
5 changed files with 51 additions and 48 deletions

View File

@@ -1329,9 +1329,8 @@ arena_tcache_fill_small(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,
&tcache_bin_info[binind]) >> tcache->lg_fill_div[binind];
CACHE_BIN_PTR_ARRAY_DECLARE(ptrs, nfill);
cache_bin_ptr_array_init_for_fill(&ptrs, tbin, nfill,
&tcache_bin_info[binind]);
cache_bin_init_ptr_array_for_fill(tbin, &tcache_bin_info[binind], &ptrs,
nfill);
/*
* Bin-local resources are used first: 1) bin->slabcur, and 2) nonfull
* slabs. After both are exhausted, new slabs will be allocated through
@@ -1443,8 +1442,7 @@ label_refill:
fresh_slab = NULL;
}
cache_bin_fill_from_ptr_array(tbin, &ptrs, filled,
&tcache_bin_info[binind]);
cache_bin_finish_fill(tbin, &tcache_bin_info[binind], &ptrs, filled);
arena_decay_tick(tsdn, arena);
}

View File

@@ -110,8 +110,8 @@ tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,
assert(tcache->arena != NULL);
arena_tcache_fill_small(tsdn, arena, tcache, tbin, binind);
ret = cache_bin_alloc_easy(tbin, tcache_success,
&tcache_bin_info[binind]);
ret = cache_bin_alloc_easy(tbin, &tcache_bin_info[binind],
tcache_success);
return ret;
}
@@ -182,8 +182,8 @@ tcache_bin_flush_impl(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
VARIABLE_ARRAY(edata_t *, item_edata, nflush + 1);
CACHE_BIN_PTR_ARRAY_DECLARE(ptrs, nflush);
cache_bin_ptr_array_init_for_flush(&ptrs, tbin, nflush,
&tcache_bin_info[binind]);
cache_bin_init_ptr_array_for_flush(tbin, &tcache_bin_info[binind],
&ptrs, nflush);
/* Look up edata once per item. */
if (config_opt_safety_checks) {
@@ -348,7 +348,7 @@ tcache_bin_flush_impl(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
memmove(tbin->cur_ptr.ptr + (ncached - rem), tbin->cur_ptr.ptr, rem *
sizeof(void *));
cache_bin_ncached_set(tbin, rem, &tcache_bin_info[binind]);
cache_bin_ncached_set(tbin, &tcache_bin_info[binind], rem);
if (tbin->cur_ptr.lowbits > tbin->low_water_position) {
tbin->low_water_position = tbin->cur_ptr.lowbits;
}