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

Alexandre DERUMIER aderumier at odiso.com
Fri Jun 19 09:00:49 CEST 2015


>> LIBS="-ljemalloc $LIBS" 
>> 
>> should be enough? 
>
>If it works with LD_PRELOAD, then yes this _should_ be enough. I'm just 
>not sure if ld's --as-needed if used, and whether this might make it 
>drop the library though. 

Just tested here, it's working fine.
I'll try to make a clean patch and send them to qemu mailing too
(ceph guys will be happy ;)


>>I'm a little confused though as to whether it's tcmalloc or jemalloc 
>>now. The libgoogle-perftools package seems to contain tcmalloc.so, 
>>while there's another package named libjemalloc1 around? 

tcmalloc is in libgoogle-perftools package
libjemalloc is in libjemalloc1 package.




----- Mail original -----
De: "Wolfgang Bumiller" <w.bumiller at proxmox.com>
À: "aderumier" <aderumier at odiso.com>
Cc: "dietmar" <dietmar at proxmox.com>, "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Vendredi 19 Juin 2015 08:58:25
Objet: Re: [pve-devel] [PATCH] use jemalloc as memory allocator

> LIBS="-ljemalloc $LIBS" 
> 
> should be enough? 

If it works with LD_PRELOAD, then yes this _should_ be enough. I'm just 
not sure if ld's --as-needed if used, and whether this might make it 
drop the library though. 

I'm a little confused though as to whether it's tcmalloc or jemalloc 
now. The libgoogle-perftools package seems to contain tcmalloc.so, 
while there's another package named libjemalloc1 around? 

On Fri, Jun 19, 2015 at 08:29:54AM +0200, Alexandre DERUMIER wrote: 
> >>can we directly link the library instead of using LD_PRELOAD? 
> 
> I think yes, but I really don't known how to patch qemu. 
> 
> maybe something like tcmalloc qemu patch 
> 
> + if compile_prog "" "-ltcmalloc" ; then 
> + LIBS="-ltcmalloc $LIBS" 
> + else 
> + feature_not_found "tcmalloc" "install gperftools devel" 
> + fi 
> 
> 
> jemmaloc doc : 
> https://github.com/jemalloc/jemalloc/wiki/Getting-Started 
> 
> cc app.c -o app -L${JEMALLOC_PATH}/lib -Wl,-rpath,${JEMALLOC_PATH}/lib -ljemalloc 
> 
> 
> 
> maybe 
> LIBS="-ljemalloc $LIBS" 
> 
> should be enough? 
> 
> 
> 
> ----- Mail original ----- 
> De: "dietmar" <dietmar at proxmox.com> 
> À: "aderumier" <aderumier at odiso.com>, "pve-devel" <pve-devel at pve.proxmox.com> 
> Envoyé: Jeudi 18 Juin 2015 14:14:47 
> Objet: Re: [pve-devel] [PATCH] use jemalloc as memory allocator 
> 
> can we directly link the library instead of using LD_PRELOAD? 
> 
> On 06/17/2015 09:31 AM, Alexandre Derumier wrote: 
> > Signed-off-by: Alexandre Derumier <aderumier at odiso.com> 
> > --- 
> > PVE/QemuServer.pm | 1 + 
> > 1 file changed, 1 insertion(+) 
> > 
> > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm 
> > index ab9ac74..455c473 100644 
> > --- a/PVE/QemuServer.pm 
> > +++ b/PVE/QemuServer.pm 
> > @@ -4153,6 +4153,7 @@ sub vm_start { 
> > 
> > # set environment variable useful inside network script 
> > $ENV{PVE_MIGRATED_FROM} = $migratedfrom if $migratedfrom; 
> > + $ENV{LD_PRELOAD} = "/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"; 
> > 
> > my ($cmd, $vollist, $spice_port) = config_to_command($storecfg, $vmid, $conf, $defaults, $forcemachine); 
> > 
> _______________________________________________ 
> pve-devel mailing list 
> pve-devel at pve.proxmox.com 
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 


More information about the pve-devel mailing list