[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 34/43] configure: Add support for jemalloc
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 34/43] configure: Add support for jemalloc |
Date: |
Wed, 9 Sep 2015 15:50:04 +0200 |
From: Alexandre Derumier <address@hidden>
This adds "--enable-jemalloc" and "--disable-jemalloc" to allow linking
to jemalloc memory allocator.
We have already tcmalloc support,
but it seem to not working well with a lot of iothreads/disks.
The main problem is that tcmalloc use a shared thread cache of 16MB
by default.
With more threads, this cache is shared, and some bad garbage collections
can occur if the cache is too low.
It's possible to tcmalloc cache increase it with a env var:
TCMALLOC_MAX_TOTAL_THREAD_CACHE_BYTES=256MB
With default 16MB, performances are really bad with more than 2 disks.
Increasing to 256MB, it's helping but still have problem with 16
disks/iothreads.
Jemalloc don't have performance problem with default configuration.
Here the benchmark results in iops of 1 qemu vm randread 4K iodepth=32,
with rbd block backend (librbd is doing a lot of memory allocation),
1 iothread by disk
glibc malloc
------------
1 disk 29052
2 disks 55878
4 disks 127899
8 disks 240566
15 disks 269976
jemalloc
--------
1 disk 41278
2 disks 75781
4 disks 195351
8 disks 294241
15 disks 298199
tcmalloc 2.2.1 default 16M cache
--------------------------------
1 disk 37911
2 disks 67698
4 disks 41076
8 disks 43312
15 disks 37569
tcmalloc : 256M cache
---------------------------
1 disk 33914
2 disks 58839
4 disks 148205
8 disks 213298
15 disks 218383
Signed-off-by: Alexandre Derumier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
configure | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/configure b/configure
index 34e49b4..5332482 100755
--- a/configure
+++ b/configure
@@ -337,6 +337,7 @@ libssh2=""
vhdx=""
numa=""
tcmalloc="no"
+jemalloc="no"
# parse CC options first
for opt do
@@ -1143,6 +1144,10 @@ for opt do
;;
--enable-tcmalloc) tcmalloc="yes"
;;
+ --disable-jemalloc) jemalloc="no"
+ ;;
+ --enable-jemalloc) jemalloc="yes"
+ ;;
*)
echo "ERROR: unknown option $opt"
echo "Try '$0 --help' for more information"
@@ -1367,6 +1372,7 @@ disabled with --disable-FEATURE, default is enabled if
available:
vhdx support for the Microsoft VHDX image format
numa libnuma support
tcmalloc tcmalloc support
+ jemalloc jemalloc support
NOTE: The object files are built at the place where configure is launched
EOF
@@ -3367,6 +3373,11 @@ EOF
fi
fi
+if test "$tcmalloc" = "yes" && test "$jemalloc" = "yes" ; then
+ echo "ERROR: tcmalloc && jemalloc can't be used at the same time"
+ exit 1
+fi
+
##########################################
# tcmalloc probe
@@ -3384,6 +3395,22 @@ EOF
fi
##########################################
+# jemalloc probe
+
+if test "$jemalloc" = "yes" ; then
+ cat > $TMPC << EOF
+#include <stdlib.h>
+int main(void) { malloc(1); return 0; }
+EOF
+
+ if compile_prog "" "-ljemalloc" ; then
+ LIBS="-ljemalloc $LIBS"
+ else
+ feature_not_found "jemalloc" "install jemalloc devel"
+ fi
+fi
+
+##########################################
# signalfd probe
signalfd="no"
cat > $TMPC << EOF
@@ -4594,6 +4621,7 @@ echo "snappy support $snappy"
echo "bzip2 support $bzip2"
echo "NUMA host support $numa"
echo "tcmalloc support $tcmalloc"
+echo "jemalloc support $jemalloc"
if test "$sdl_too_old" = "yes"; then
echo "-> Your SDL version is too old - please upgrade to have SDL support"
--
2.4.3
- [Qemu-devel] [PULL 23/43] cutils: Add qemu_strtol() wrapper, (continued)
- [Qemu-devel] [PULL 23/43] cutils: Add qemu_strtol() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 28/43] CODING_STYLE: update mixed declaration rules, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 26/43] cutils: Add qemu_strtoull() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 24/43] cutils: Add qemu_strtoul() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 27/43] qmp: Add example usage of strto*l() qemu wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 25/43] cutils: Add qemu_strtoll() wrapper, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 29/43] checkpatch: adapt some tests to QEMU, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 30/43] checkpatch: remove tests that are not relevant outside the kernel, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 32/43] configure: factor out adding disas configure, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 34/43] configure: Add support for jemalloc,
Paolo Bonzini <=
- [Qemu-devel] [PULL 35/43] scripts/dump-guest-memory.py: fix after RAMBlock change, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 33/43] add macro file for coccinelle, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread globals, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 36/43] cpus: protect work list with work_mutex, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 41/43] tcg: comment on which functions have to be called with mmap_lock held, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 39/43] remove unused spinlock., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc accesses, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally available, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 38/43] replace spinlock by QemuMutex., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 43/43] cpu-exec: fix lock hierarchy for user-mode emulation, Paolo Bonzini, 2015/09/09