Simplify / refactor tcache_dalloc_large.

This commit is contained in:
Qi Wang 2019-08-12 11:11:01 -07:00 committed by Qi Wang
parent 9c5c2a2c86
commit e2c7584361

View File

@ -201,13 +201,12 @@ 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(!cache_bin_dalloc_easy(bin, bin_info, ptr))) {
tcache_bin_flush_large(tsd, tcache, bin, binind, tcache_bin_flush_large(tsd, tcache, bin, binind,
(bin_info->ncached_max >> 1)); (bin_info->ncached_max >> 1));
bool ret = cache_bin_dalloc_easy(bin, bin_info, ptr);
assert(ret);
} }
assert(bin->ncached < bin_info->ncached_max);
bin->ncached++;
*(bin->avail - bin->ncached) = ptr;
tcache_event(tsd, tcache); tcache_event(tsd, tcache);
} }