[pve-devel] [PATCH] use jemalloc as default memory allocator

Alexandre Derumier aderumier at odiso.com
Fri Jun 19 14:41:14 CEST 2015


(jemalloc support patch sent to qemu devel mailing list
 http://lists.nongnu.org/archive/html/qemu-devel/2015-06/msg05265.html
)

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 debian/control                |   4 +-
 debian/patches/jemalloc.patch |  61 +++++++++++++++++++++++
 debian/patches/series         |   1 +
 debian/patches/tcmalloc.patch | 109 ------------------------------------------
 debian/rules                  |   2 +-
 5 files changed, 65 insertions(+), 112 deletions(-)
 create mode 100644 debian/patches/jemalloc.patch
 delete mode 100644 debian/patches/tcmalloc.patch

diff --git a/debian/control b/debian/control
index cef4c0b..77e42f3 100644
--- a/debian/control
+++ b/debian/control
@@ -2,12 +2,12 @@ Source: pve-qemu-kvm
 Section: admin
 Priority: extra
 Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: debhelper (>= 5), autotools-dev, libpci-dev, quilt, texinfo, texi2html, libgnutls28-dev, libsdl1.2-dev, check, libaio-dev, uuid-dev, librbd-dev (>= 0.48), libiscsi-dev (>= 1.12.0), libspice-protocol-dev (>= 0.12.5),  pve-libspice-server-dev (>= 0.12.5-1), libusbredirparser-dev (>= 0.6-2), glusterfs-common (>= 3.5.2-1), libusb-1.0-0-dev (>= 1.0.17-1), xfslibs-dev, libnuma-dev
+Build-Depends: debhelper (>= 5), autotools-dev, libpci-dev, quilt, texinfo, texi2html, libgnutls28-dev, libsdl1.2-dev, check, libaio-dev, uuid-dev, librbd-dev (>= 0.48), libiscsi-dev (>= 1.12.0), libspice-protocol-dev (>= 0.12.5),  pve-libspice-server-dev (>= 0.12.5-1), libusbredirparser-dev (>= 0.6-2), glusterfs-common (>= 3.5.2-1), libusb-1.0-0-dev (>= 1.0.17-1), xfslibs-dev, libnuma-dev, libjemalloc-dev
 Standards-Version: 3.7.2
 
 Package: pve-qemu-kvm
 Architecture: any
-Depends: iproute, bridge-utils, python, libsdl1.2debian, libaio1, libuuid1, ceph-common (>= 0.48), libiscsi4 (>= 1.12.0), pve-libspice-server1 (>= 0.12.5-1), ${shlibs:Depends}, ${misc:Depends}, libusbredirparser1 (>= 0.6-2), glusterfs-common (>= 3.5.2-1), libusb-1.0-0 (>= 1.0.17-1), numactl
+Depends: iproute, bridge-utils, python, libsdl1.2debian, libaio1, libuuid1, ceph-common (>= 0.48), libiscsi4 (>= 1.12.0), pve-libspice-server1 (>= 0.12.5-1), ${shlibs:Depends}, ${misc:Depends}, libusbredirparser1 (>= 0.6-2), glusterfs-common (>= 3.5.2-1), libusb-1.0-0 (>= 1.0.17-1), numactl, libjemalloc1
 Conflicts: qemu, qemu-kvm, kvm, pve-kvm, pve-qemu-kvm-2.6.18
 Replaces: pve-kvm, pve-qemu-kvm-2.6.18
 Description: Full virtualization on x86 hardware
diff --git a/debian/patches/jemalloc.patch b/debian/patches/jemalloc.patch
new file mode 100644
index 0000000..b5dba0d
--- /dev/null
+++ b/debian/patches/jemalloc.patch
@@ -0,0 +1,61 @@
+--- a/configure
++++ b/configure
+@@ -336,6 +336,7 @@ libssh2=""
+ vhdx=""
+ quorum=""
+ numa=""
++jemalloc="no"
+ 
+ # parse CC options first
+ for opt do
+@@ -1134,6 +1135,10 @@ for opt do
+   ;;
+   --enable-numa) numa="yes"
+   ;;
++  --disable-jemalloc) jemalloc="no"
++  ;;
++  --enable-jemalloc) jemalloc="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-jemalloc       disable jemalloc support
++  --enable-numa            enable jemalloc support
+ 
+ NOTE: The object files are built at the place where configure is launched
+ EOF
+@@ -3325,6 +3332,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
+@@ -4435,6 +4458,7 @@ echo "lzo support       $lzo"
+ echo "snappy support    $snappy"
+ echo "bzip2 support     $bzip2"
+ echo "NUMA host support $numa"
++echo "jemalloc support  $jemalloc"
+ 
+ if test "$sdl_too_old" = "yes"; then
+ echo "-> Your SDL version is too old - please upgrade to have SDL support"
diff --git a/debian/patches/series b/debian/patches/series
index 72fd0e6..1105537 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -32,3 +32,4 @@ gluster-backupserver.patch
 add-qmp-get-link-status.patch
 0001-friendlier-ai_flag-hints-for-ipv6-hosts.patch
 0001-vvfat-add-a-label-option.patch
+jemalloc.patch
diff --git a/debian/patches/tcmalloc.patch b/debian/patches/tcmalloc.patch
deleted file mode 100644
index 40eab94..0000000
--- a/debian/patches/tcmalloc.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From patchwork Thu Mar 26 03:03:12 2015
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-Subject: configure: Add support for tcmalloc
-From: Fam Zheng <famz at redhat.com>
-X-Patchwork-Id: 454848
-Message-Id: <1427338992-27057-1-git-send-email-famz at redhat.com>
-To: qemu-devel at nongnu.org
-Cc: kwolf at redhat.com, Paolo Bonzini <pbonzini at redhat.com>,
- Stefan Hajnoczi <stefanha at redhat.com>,
- Peter Maydell <peter.maydell at linaro.org>
-Date: Thu, 26 Mar 2015 11:03:12 +0800
-
-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>
----
- configure | 24 ++++++++++++++++++++++++
- 1 file changed, 24 insertions(+)
-
-diff --git a/configure b/configure
-index 589798e..03ba305 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-numa            enable tcmalloc support
- 
- NOTE: The object files are built at the place where configure is launched
- EOF
-@@ -3325,6 +3332,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
-@@ -4435,6 +4458,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"
diff --git a/debian/rules b/debian/rules
index e06e534..73837ca 100755
--- a/debian/rules
+++ b/debian/rules
@@ -33,7 +33,7 @@ endif
 config.status: configure
 	dh_testdir
 	# Add here commands to configure the package.
-	./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --localstatedir=/var --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --disable-smartcard-nss --audio-drv-list="alsa" --enable-spice --enable-usb-redir --enable-glusterfs --enable-libusb --disable-gtk --enable-xfsctl --enable-numa --disable-strip
+	./configure --with-confsuffix="/kvm" --target-list=x86_64-softmmu --prefix=/usr --datadir=/usr/share --docdir=/usr/share/doc/pve-qemu-kvm --sysconfdir=/etc --localstatedir=/var --disable-xen --enable-vnc-tls --enable-sdl --enable-uuid --enable-linux-aio --enable-rbd --enable-libiscsi --disable-smartcard-nss --audio-drv-list="alsa" --enable-spice --enable-usb-redir --enable-glusterfs --enable-libusb --disable-gtk --enable-xfsctl --enable-numa --disable-strip --enable-jemalloc
 
 build: patch build-stamp
 
-- 
2.1.4




More information about the pve-devel mailing list