From 6b836b6b4148a3623e35807e998097865b9ebb3a Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 24 Jul 2015 10:15:04 +0200 Subject: [PATCH] Jemalloc: use LG_QUANTUM of 3 for AMD64 and I386. This gives us a 24 bytes size class which is dict.c dictEntry size, thus improving the memory efficiency of Redis significantly. Moreover other non 16 bytes aligned tiny classes are added that further reduce the fragmentation of the allocator. Technically speaking LG_QUANTUM should be 4 on i386 / AMD64 because of SSE types and other 16 bytes types, however we don't use those, and our jemalloc only targets Redis. New versions of Jemalloc will have an explicit configure switch in order to specify the quantum value for a platform without requiring any change to the Jemalloc source code: we'll switch to this system when available. This change was originally proposed by Oran Agra (@oranagra) as a change to the Jemalloc script to generate the size classes define. We ended doing it differently by changing LG_QUANTUM since it is apparently the supported Jemalloc method to obtain a 24 bytes size class, moreover it also provides us other potentially useful size classes. Related to issue #2510. --- .../jemalloc/include/jemalloc/internal/jemalloc_internal.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in index 574bbb141..df266abb7 100644 --- a/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in +++ b/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h.in @@ -242,7 +242,7 @@ static const bool config_ivsalloc = */ #ifndef LG_QUANTUM # if (defined(__i386__) || defined(_M_IX86)) -# define LG_QUANTUM 4 +# define LG_QUANTUM 3 # endif # ifdef __ia64__ # define LG_QUANTUM 4 @@ -254,7 +254,7 @@ static const bool config_ivsalloc = # define LG_QUANTUM 4 # endif # if (defined(__amd64__) || defined(__x86_64__) || defined(_M_X64)) -# define LG_QUANTUM 4 +# define LG_QUANTUM 3 # endif # ifdef __arm__ # define LG_QUANTUM 3