Fix incorrect stats mreging with sharded bins.

With sharded bins, we may not flush all items from the same arena in one run.
Adjust the stats merging logic accordingly.
This commit is contained in:
Qi Wang 2018-12-07 18:06:04 -08:00 committed by Qi Wang
parent 711a61f3b4
commit 99f4eefb61

View File

@ -134,8 +134,7 @@ tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, cache_bin_t *tbin,
} }
malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock); malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
if (config_stats && bin_arena == arena) { if (config_stats && bin_arena == arena && !merged_stats) {
assert(!merged_stats);
merged_stats = true; merged_stats = true;
bin->stats.nflushes++; bin->stats.nflushes++;
bin->stats.nrequests += tbin->tstats.nrequests; bin->stats.nrequests += tbin->tstats.nrequests;