From 99f4eefb61ae1f13e47af6eac34748fd0a789404 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Fri, 7 Dec 2018 18:06:04 -0800 Subject: [PATCH] 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. --- src/tcache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tcache.c b/src/tcache.c index 51e3131e..92be273a 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -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); - if (config_stats && bin_arena == arena) { - assert(!merged_stats); + if (config_stats && bin_arena == arena && !merged_stats) { merged_stats = true; bin->stats.nflushes++; bin->stats.nrequests += tbin->tstats.nrequests;