Robert,

I'm currently working on some enhancements for libc's malloc() (and friends) which are primarily targeted at improving packing and thread scalability for small allocations (1-128 bytes).

I haven't given realloc() much consideration, although I have noted that some implementations under Solaris even do the copy when the size hasn't changed!

I would love to know more about the workloads / benchmarks you are using and, in particular, the allocation sizes you are most interested in. As you mention mremap() I guess we are talking multiple page per allocation?

Apart from libmapmalloc (hardly general purpose), and an option to libumem, none of our current implementations use mmap() to implement malloc() or realloc(). The main reason for this is that our brk()/sbrk() is quicker than our mmap(MAP_ANON).

As such mremap() wouldn't really buy us much just now.

Phil



Robert Milkowski wrote:
Hi.

   We've observed that on Linux some of our applications are running 
considerably faster on the same hardware - the problem is realloc() which is 
generally much faster on Linux than on Solaris. We mitigate problem a little 
bit by eliminating most of realloc()'s but still we would like to have better 
implementation on Solaris.

Using dtrace we were able to determine that when it comes to realloc() it's 
fastest with default memory allocator from libc, them umem then mtmalloc. 
libc's realloc() is fastest mostly due to fact that not all realloc()'s require 
copying data.

Here's umem's realloc() 
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libumem/common/malloc.c#389

And here's libc implementation  
http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/malloc.c#302

Linux glibc implementation uses mremap() and this is what gives huge boost. For 
some details on mremap() see http://www.die.net/doc/linux/man/man2/mremap.2.html
http://www.core-dump.com.hr/?q=node/129

I believe implementing mremap() on Solaris would really help.
The problem is really visible for example in PHP applications when serving web 
pages - lots of realloc()'s.
This message posted from opensolaris.org
_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to