* [Qemu-devel] [PATCH] configure: Add support for tcmalloc
@ 2015-03-26 3:03 Fam Zheng
2015-03-26 12:53 ` Kevin Wolf
0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2015-03-26 3:03 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Stefan Hajnoczi, Peter Maydell
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@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"
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Add support for tcmalloc
2015-03-26 3:03 [Qemu-devel] [PATCH] configure: Add support for tcmalloc Fam Zheng
@ 2015-03-26 12:53 ` Kevin Wolf
2015-03-26 13:14 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2015-03-26 12:53 UTC (permalink / raw)
To: Fam Zheng; +Cc: Paolo Bonzini, qemu-devel, Stefan Hajnoczi, Peter Maydell
Am 26.03.2015 um 04:03 hat Fam Zheng geschrieben:
> 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@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
Almost. :-)
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: Add support for tcmalloc
2015-03-26 12:53 ` Kevin Wolf
@ 2015-03-26 13:14 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-26 13:14 UTC (permalink / raw)
To: Kevin Wolf, Fam Zheng; +Cc: Peter Maydell, qemu-devel, Stefan Hajnoczi
On 26/03/2015 13:53, Kevin Wolf wrote:
> Am 26.03.2015 um 04:03 hat Fam Zheng geschrieben:
>> 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@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
>
> Almost. :-)
Will fix and apply for 2.4.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-26 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-26 3:03 [Qemu-devel] [PATCH] configure: Add support for tcmalloc Fam Zheng
2015-03-26 12:53 ` Kevin Wolf
2015-03-26 13:14 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).