diff options
author | Jason Evans <je@fb.com> | 2016-04-25 13:26:54 -0700 |
---|---|---|
committer | Jason Evans <je@fb.com> | 2016-04-25 13:26:54 -0700 |
commit | 7e6749595a570ed6686603a1bcfdf8cf49147f19 (patch) | |
tree | 63f138cc87a69dba990bb6789f33a8ee005f0f3f /src | |
parent | 2fe64d237cf65baa9f6056622e896949933355e5 (diff) | |
download | jemalloc-7e6749595a570ed6686603a1bcfdf8cf49147f19.tar.gz |
Fix arena reset effects on large/huge stats.
Reset large curruns to 0 during arena reset.
Do not increase huge ndalloc stats during arena reset.
Diffstat (limited to 'src')
-rw-r--r-- | src/arena.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/arena.c b/src/arena.c index f752aca..c6859e3 100644 --- a/src/arena.c +++ b/src/arena.c @@ -855,6 +855,17 @@ arena_huge_dalloc_stats_update(arena_t *arena, size_t usize) } static void +arena_huge_reset_stats_cancel(arena_t *arena, size_t usize) +{ + szind_t index = size2index(usize) - nlclasses - NBINS; + + cassert(config_stats); + + arena->stats.ndalloc_huge++; + arena->stats.hstats[index].ndalloc--; +} + +static void arena_huge_dalloc_stats_update_undo(arena_t *arena, size_t usize) { szind_t index = size2index(usize) - nlclasses - NBINS; @@ -1884,22 +1895,30 @@ arena_reset(tsd_t *tsd, arena_t *arena) } } + /* Reset curruns for large size classes. */ + if (config_stats) { + for (i = 0; i < nlclasses; i++) + arena->stats.lstats[i].curruns = 0; + } + /* Huge allocations. */ malloc_mutex_lock(tsd, &arena->huge_mtx); for (node = ql_last(&arena->huge, ql_link); node != NULL; node = ql_last(&arena->huge, ql_link)) { void *ptr = extent_node_addr_get(node); + size_t usize; malloc_mutex_unlock(tsd, &arena->huge_mtx); - /* Remove huge allocation from prof sample set. */ - if (config_prof && opt_prof) { - size_t usize; - + if (config_stats || (config_prof && opt_prof)) usize = isalloc(tsd, ptr, config_prof); + /* Remove huge allocation from prof sample set. */ + if (config_prof && opt_prof) prof_free(tsd, ptr, usize); - } huge_dalloc(tsd, ptr); malloc_mutex_lock(tsd, &arena->huge_mtx); + /* Cancel out unwanted effects on stats. */ + if (config_stats) + arena_huge_reset_stats_cancel(arena, usize); } malloc_mutex_unlock(tsd, &arena->huge_mtx); |