From 17aa470760cefb3057be746f7022196035f0cfbe Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Mon, 29 Oct 2018 15:09:21 -0700 Subject: [PATCH] add extent_nfree_sub --- include/jemalloc/internal/extent_inlines.h | 6 ++++++ src/arena.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/jemalloc/internal/extent_inlines.h b/include/jemalloc/internal/extent_inlines.h index 145fa2d6..c931fd58 100644 --- a/include/jemalloc/internal/extent_inlines.h +++ b/include/jemalloc/internal/extent_inlines.h @@ -264,6 +264,12 @@ extent_nfree_dec(extent_t *extent) { extent->e_bits -= ((uint64_t)1U << EXTENT_BITS_NFREE_SHIFT); } +static inline void +extent_nfree_sub(extent_t *extent, uint64_t n) { + assert(extent_slab_get(extent)); + extent->e_bits -= (n << EXTENT_BITS_NFREE_SHIFT); +} + static inline void extent_sn_set(extent_t *extent, size_t sn) { extent->e_bits = (extent->e_bits & ~EXTENT_BITS_SN_MASK) | diff --git a/src/arena.c b/src/arena.c index fc2a7dff..841f2950 100644 --- a/src/arena.c +++ b/src/arena.c @@ -283,10 +283,10 @@ arena_slab_reg_alloc_batch(extent_t *slab, const bin_info_t *bin_info, regind = bitmap_sfu(slab_data->bitmap, &bin_info->bitmap_info); ret = (void *)((uintptr_t)extent_addr_get(slab) + (uintptr_t)(bin_info->reg_size * regind)); - extent_nfree_dec(slab); *(ptrs + i) = ret; } + extent_nfree_sub(slab, cnt); } #ifndef JEMALLOC_JET