Use trylock in tcache_bin_flush when possible.

During tcache gc, use tcache_bin_try_flush_small / _large so that we can skip
items with their bins locked already.
This commit is contained in:
Qi Wang
2017-04-25 13:31:45 -07:00
committed by Qi Wang
parent e2aad5e810
commit 8584adc451
3 changed files with 142 additions and 63 deletions

View File

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