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.
This commit is contained in:
antirez 2015-07-24 10:15:04 +02:00
parent 64fcd0e6ff
commit 6b836b6b41

View File

@ -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