]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/tcmalloc.patch
tcmalloc.patch: make it work without bash
[pve-qemu-kvm.git] / debian / patches / tcmalloc.patch
CommitLineData
55b6a56e
AD
1From patchwork Thu Mar 26 03:03:12 2015
2Content-Type: text/plain; charset="utf-8"
3MIME-Version: 1.0
4Content-Transfer-Encoding: 7bit
5Subject: configure: Add support for tcmalloc
6From: Fam Zheng <famz@redhat.com>
7X-Patchwork-Id: 454848
8Message-Id: <1427338992-27057-1-git-send-email-famz@redhat.com>
9To: qemu-devel@nongnu.org
10Cc: kwolf@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
11 Stefan Hajnoczi <stefanha@redhat.com>,
12 Peter Maydell <peter.maydell@linaro.org>
13Date: Thu, 26 Mar 2015 11:03:12 +0800
14
15This adds "--enable-tcmalloc" and "--disable-tcmalloc" to allow linking
16to libtcmalloc from gperftools.
17
18tcmalloc is a malloc implementation that works well with threads and is
19fast, so it is good for performance.
20
21It is disabled by default, because the MALLOC_PERTURB_ flag we use in
22tests doesn't work with tcmalloc. However we can enable tcmalloc
23specific heap checker and profilers later.
24
25An IOPS gain can be observed with virtio-blk-dataplane, other parts of
26QEMU will directly benefit from it as well:
27
28==========================================================
29 glibc malloc
30----------------------------------------------------------
31rw bs iodepth bw iops latency
32read 4k 1 150 38511 24
33----------------------------------------------------------
34
35==========================================================
36 tcmalloc
37----------------------------------------------------------
38rw bs iodepth bw iops latency
39read 4k 1 156 39969 23
40----------------------------------------------------------
41
42Signed-off-by: Fam Zheng <famz@redhat.com>
43---
44 configure | 24 ++++++++++++++++++++++++
45 1 file changed, 24 insertions(+)
46
47diff --git a/configure b/configure
48index 589798e..03ba305 100755
49--- a/configure
50+++ b/configure
51@@ -336,6 +336,7 @@ libssh2=""
52 vhdx=""
53 quorum=""
54 numa=""
55+tcmalloc="no"
56
57 # parse CC options first
58 for opt do
59@@ -1134,6 +1135,10 @@ for opt do
60 ;;
61 --enable-numa) numa="yes"
62 ;;
63+ --disable-tcmalloc) tcmalloc="no"
64+ ;;
65+ --enable-tcmalloc) tcmalloc="yes"
66+ ;;
67 *)
68 echo "ERROR: unknown option $opt"
69 echo "Try '$0 --help' for more information"
70@@ -1407,6 +1412,8 @@ Advanced options (experts only):
71 --enable-quorum enable quorum block filter support
72 --disable-numa disable libnuma support
73 --enable-numa enable libnuma support
74+ --disable-tcmalloc disable tcmalloc support
75+ --enable-numa enable tcmalloc support
76
77 NOTE: The object files are built at the place where configure is launched
78 EOF
79@@ -3325,6 +3332,22 @@ EOF
80 fi
81
82 ##########################################
83+# tcmalloc probe
84+
d0b291c6 85+if test "$tcmalloc" = "yes" ; then
55b6a56e
AD
86+ cat > $TMPC << EOF
87+#include <stdlib.h>
88+int main(void) { malloc(1); return 0; }
89+EOF
90+
91+ if compile_prog "" "-ltcmalloc" ; then
92+ LIBS="-ltcmalloc $LIBS"
93+ else
94+ feature_not_found "tcmalloc" "install gperftools devel"
95+ fi
96+fi
97+
98+##########################################
99 # signalfd probe
100 signalfd="no"
101 cat > $TMPC << EOF
102@@ -4435,6 +4458,7 @@ echo "lzo support $lzo"
103 echo "snappy support $snappy"
104 echo "bzip2 support $bzip2"
105 echo "NUMA host support $numa"
106+echo "tcmalloc support $tcmalloc"
107
108 if test "$sdl_too_old" = "yes"; then
109 echo "-> Your SDL version is too old - please upgrade to have SDL support"