[PATCH] change default malloc thresholds of PPC64

Steve Munroe sjmunroe@us.ibm.com
Tue Mar 22 23:03:00 GMT 2005


The current DEFAULT_TRIM_THRESHOLD and DEFAULT_MMAP_THRESHOLD setting of 
128K are too small for most applications targeting powerpc64. 
Applications that need the 64-bit address space also tend to allocate 
large arrays and data structions. If these are dynamic (via new or 
malloc) the use of mmap vs brk storage can have significant performance 
impact. This especially true for threaded applications where the 
sequenctial allocation and zeroing of mmap pages for a large allocation 
will bottleneck in the kernel.

In my case a threaded malloc test case (which randomizes the malloc size 
over an interval and touches every page thus allocated) shows 
significant (45%) performance degradation as the occational (<5%) 
allocation approaches the threshold. And becomes 20+ times worse as the 
average allocation exceeds the threshold.

So for these applications it is better for malloc to keep most 
allocations in brk storage where the page zero overhead only ocurrs 
once. But we need to increate the DEFAULT_TRIM_THRESHOLD and 
DEFAULT_MMAP_THRESHOLD to do this.

The attached paches (for nptl and linuxthreads) use 
powerpc64/malloc-machine.h to overide generic DEFAULT_TRIM_THRESHOLD and 
DEFAULT_MMAP_THRESHOLD setting of 128KB to a more appropriate 16MB.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc64-malloc-nptl-20050310.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050322/dadaaacb/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ppc64-malloc-lt-20050310.txt
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20050322/dadaaacb/attachment-0001.txt>


More information about the Libc-alpha mailing list