From 908d3bdad96ca44f2019d074f5d548058ab5d27c Mon Sep 17 00:00:00 2001 From: Yoav Steinberg Date: Sun, 10 Oct 2021 12:44:55 +0300 Subject: [PATCH] Fix defrag to support sharded bins in arena (added in v5.2.1) See https://github.com/jemalloc/jemalloc/commit/37b89139252db18c95ebce3e0eac67817fa4a8ab --- .../include/jemalloc/internal/jemalloc_internal_inlines_c.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h index 17b2472ff..93eba1e57 100644 --- a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h +++ b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal_inlines_c.h @@ -232,7 +232,8 @@ iget_defrag_hint(tsdn_t *tsdn, void* ptr, int *bin_util, int *run_util) { extent_t *slab = iealloc(tsdn, ptr); arena_t *arena = extent_arena_get(slab); szind_t binind = extent_szind_get(slab); - bin_t *bin = &arena->bins[binind]; + unsigned binshard = extent_binshard_get(slab); + bin_t *bin = &arena->bins[binind].bin_shards[binshard]; malloc_mutex_lock(tsdn, &bin->lock); /* don't bother moving allocations from the slab currently used for new allocations */ if (slab != bin->slabcur) {