xfs
[Top] [All Lists]

Re: [PATCH 3/3] xfsprogs: allow linking against libtcmalloc

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 3/3] xfsprogs: allow linking against libtcmalloc
From: Arkadiusz Miśkiewicz <arekm@xxxxxxxx>
Date: Fri, 18 Nov 2011 08:04:06 +0100
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20111114160217.591812422@xxxxxxxxxxxxxxxxxxxxxx>
References: <20111114155742.285135418@xxxxxxxxxxxxxxxxxxxxxx> <20111114160217.591812422@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: KMail/1.13.7 (Linux/3.2.0-rc1-00306-g7f80850-dirty; KDE/4.7.3; x86_64; ; )
On Monday 14 of November 2011, Christoph Hellwig wrote:
> Allow linking against the libtcmalloc library from Google's performance
> tools, which at least for repair reduces the memory usage dramatically.

Should -fno-builtin-malloc be also used?

--- xfsprogs-3.1.7/configure.in.org     2011-11-18 07:58:49.815439699 +0100
+++ xfsprogs-3.1.7/configure.in 2011-11-18 07:59:49.360093001 +0100
@@ -31,6 +31,26 @@
 AC_SUBST(libeditline)
 AC_SUBST(enable_editline)
 
+AC_ARG_ENABLE(tcmalloc,
+[ --enable-tcmalloc=[yes/no] Enable tcmalloc [default=no]],,
+       enable_tcmalloc=check)
+
+if test x$enable_tcmalloc != xno; then
+    saved_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS -fno-builtin-malloc"
+    AC_CHECK_LIB([tcmalloc_minimal], [malloc], 
[libtcmalloc="-ltcmalloc_minimal"],
+      [AC_CHECK_LIB([tcmalloc], [malloc], [libtcmalloc="-ltcmalloc"], [
+       if test x$enable_tcmalloc = xyes; then
+               AC_MSG_ERROR([libtcmalloc_minimal or libtcmalloc library not 
found], 1)
+       fi]
+      )]
+    )
+    if test x$libtcmalloc = x; then
+       CPPFLAGS="$saved_CPPFLAGS"
+    fi
+fi
+AC_SUBST(libtcmalloc)
+
 AC_ARG_ENABLE(termcap,
 [ --enable-termcap=[yes/no] Enable terminal capabilities library [default=no]],
        test $enable_termcap = yes && libtermcap="-ltermcap",)
Index: xfsprogs-dev/include/builddefs.in
===================================================================
--- xfsprogs-dev.orig/include/builddefs.in      2011-08-14 17:00:02.000000000 
+0000
+++ xfsprogs-dev/include/builddefs.in   2011-11-14 12:09:52.000000000 +0000
@@ -22,7 +22,7 @@ _BUILDDEFS_INCLUDED_ = 1
 
 DEBUG = @debug_build@
 OPTIMIZER = @opt_build@
-MALLOCLIB = @malloc_lib@
+MALLOCLIB = @malloc_lib@ @libtcmalloc@
 LOADERFLAGS = @LDFLAGS@
 LTLDFLAGS = @LDFLAGS@
 CFLAGS = @CFLAGS@



-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/

<Prev in Thread] Current Thread [Next in Thread>