From 6591ff09d80e11f36603a75b32dc6a9b81fb3d47 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Tue, 19 May 2015 17:44:45 -0700 Subject: [PATCH] Fix arena_dalloc() performance regression. Take into account large_pad when computing whether to pass the deallocation request to tcache_dalloc_large(), so that the largest cacheable size makes it back to tcache. This regression was introduced by 8a03cf039cd06f9fa6972711195055d865673966 (Implement cache index randomization for large allocations.). --- include/jemalloc/internal/arena.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/jemalloc/internal/arena.h b/include/jemalloc/internal/arena.h index 58601954..6f3c77ce 100644 --- a/include/jemalloc/internal/arena.h +++ b/include/jemalloc/internal/arena.h @@ -1181,7 +1181,8 @@ arena_dalloc(tsd_t *tsd, void *ptr, tcache_t *tcache) assert(config_cache_oblivious || ((uintptr_t)ptr & PAGE_MASK) == 0); - if (likely(tcache != NULL) && size <= tcache_maxclass) { + if (likely(tcache != NULL) && size - large_pad <= + tcache_maxclass) { tcache_dalloc_large(tsd, tcache, ptr, size - large_pad); } else {