bonzini pushed to qemu (private-bonzini-tcmalloc). "Backport upstream 2.4 patch to link with tcmalloc, enable it"

notifications at fedoraproject.org notifications at fedoraproject.org
Sun May 10 15:40:52 UTC 2015


From a19d4b419a09991df8413a1723c039a4eb12fb84 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini at redhat.com>
Date: Sun, 10 May 2015 17:40:05 +0200
Subject: Backport upstream 2.4 patch to link with tcmalloc, enable it


diff --git a/0001-configure-Add-support-for-tcmalloc.patch b/0001-configure-Add-support-for-tcmalloc.patch
new file mode 100644
index 0000000..a1e3ae7
--- /dev/null
+++ b/0001-configure-Add-support-for-tcmalloc.patch
@@ -0,0 +1,105 @@
+From 2847b46958ab0bd604e1b3fcafba0f5ba4375833 Mon Sep 17 00:00:00 2001
+From: Fam Zheng <famz at redhat.com>
+Date: Thu, 26 Mar 2015 11:03:12 +0800
+Subject: [PATCH] configure: Add support for tcmalloc
+
+This adds "--enable-tcmalloc" and "--disable-tcmalloc" to allow linking
+to libtcmalloc from gperftools.
+
+tcmalloc is a malloc implementation that works well with threads and is
+fast, so it is good for performance.
+
+It is disabled by default, because the MALLOC_PERTURB_ flag we use in
+tests doesn't work with tcmalloc. However we can enable tcmalloc
+specific heap checker and profilers later.
+
+An IOPS gain can be observed with virtio-blk-dataplane, other parts of
+QEMU will directly benefit from it as well:
+
+==========================================================
+                       glibc malloc
+----------------------------------------------------------
+rw         bs         iodepth    bw     iops       latency
+read       4k         1          150    38511      24
+----------------------------------------------------------
+
+==========================================================
+                         tcmalloc
+----------------------------------------------------------
+rw         bs         iodepth    bw     iops       latency
+read       4k         1          156    39969      23
+----------------------------------------------------------
+
+Signed-off-by: Fam Zheng <famz at redhat.com>
+Message-Id: <1427338992-27057-1-git-send-email-famz at redhat.com>
+Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
+---
+ configure | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/configure b/configure
+index 6969f6f..75a4def 100755
+--- a/configure
++++ b/configure
+@@ -336,6 +336,7 @@ libssh2=""
+ vhdx=""
+ quorum=""
+ numa=""
++tcmalloc="no"
+ 
+ # parse CC options first
+ for opt do
+@@ -1134,6 +1135,10 @@ for opt do
+   ;;
+   --enable-numa) numa="yes"
+   ;;
++  --disable-tcmalloc) tcmalloc="no"
++  ;;
++  --enable-tcmalloc) tcmalloc="yes"
++  ;;
+   *)
+       echo "ERROR: unknown option $opt"
+       echo "Try '$0 --help' for more information"
+@@ -1407,6 +1412,8 @@ Advanced options (experts only):
+   --enable-quorum          enable quorum block filter support
+   --disable-numa           disable libnuma support
+   --enable-numa            enable libnuma support
++  --disable-tcmalloc       disable tcmalloc support
++  --enable-tcmalloc        enable tcmalloc support
+ 
+ NOTE: The object files are built at the place where configure is launched
+ EOF
+@@ -3331,6 +3338,22 @@ EOF
+ fi
+ 
+ ##########################################
++# tcmalloc probe
++
++if test "$tcmalloc" = "yes" ; then
++  cat > $TMPC << EOF
++#include <stdlib.h>
++int main(void) { malloc(1); return 0; }
++EOF
++
++  if compile_prog "" "-ltcmalloc" ; then
++    LIBS="-ltcmalloc $LIBS"
++  else
++    feature_not_found "tcmalloc" "install gperftools devel"
++  fi
++fi
++
++##########################################
+ # signalfd probe
+ signalfd="no"
+ cat > $TMPC << EOF
+@@ -4441,6 +4464,7 @@ echo "lzo support       $lzo"
+ echo "snappy support    $snappy"
+ echo "bzip2 support     $bzip2"
+ echo "NUMA host support $numa"
++echo "tcmalloc support  $tcmalloc"
+ 
+ if test "$sdl_too_old" = "yes"; then
+ echo "-> Your SDL version is too old - please upgrade to have SDL support"
+-- 
+2.4.0
+
diff --git a/qemu.spec b/qemu.spec
index 039bb0d..1d80a63 100644
--- a/qemu.spec
+++ b/qemu.spec
@@ -43,7 +43,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 2.3.0
-Release: 3%{?dist}
+Release: 4%{?dist}
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
 Group: Development/Tools
@@ -71,6 +71,8 @@ Source12: bridge.conf
 # qemu-kvm back compat wrapper
 Source13: qemu-kvm.sh
 
+Patch0: 0001-configure-Add-support-for-tcmalloc.patch
+
 BuildRequires: SDL2-devel
 BuildRequires: zlib-devel
 BuildRequires: which
@@ -87,6 +89,7 @@ BuildRequires: libiscsi-devel
 BuildRequires: ncurses-devel
 BuildRequires: libattr-devel
 BuildRequires: usbredir-devel >= 0.5.2
+BuildRequires: gperftools-devel
 BuildRequires: texinfo
 # For /usr/bin/pod2man
 BuildRequires: perl-podlators
@@ -598,6 +601,7 @@ unicore32-linux-user aarch64-softmmu"
     --audio-drv-list=pa,sdl,alsa,oss \
     --enable-trace-backend=$tracebackends \
     --enable-kvm \
+    --enable-tcmalloc \
     --with-sdlabi="2.0" \
     --with-gtkabi="3.0" \
 %ifarch s390
@@ -1172,7 +1176,10 @@ getent passwd qemu >/dev/null || \
 
 
 %changelog
-* Wed May 06 2015 Cole Robinson <crobinso at redhat.com> 2:2.3.0-3%
+* Sun May 10 2015 Paolo Bonzini <pbonzini at redhat.com> 2:2.3.0-4
+- Backport upstream 2.4 patch to link with tcmalloc, enable it
+
+* Wed May 06 2015 Cole Robinson <crobinso at redhat.com> 2:2.3.0-3
 - Fix ksm.service (bz 1218814)
 
 * Tue May  5 2015 Dan HorĂ¡k <dan[at]danny.cz> - 2:2.3.0-2
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/qemu.git/commit/?h=private-bonzini-tcmalloc&id=a19d4b419a09991df8413a1723c039a4eb12fb84


More information about the scm-commits mailing list