public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/1541] New: Poor threaded application performance when using malloc
@ 2005-10-25 14:11 sjmunroe at us dot ibm dot com
  2005-10-25 15:32 ` [Bug libc/1541] " sjmunroe at us dot ibm dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: sjmunroe at us dot ibm dot com @ 2005-10-25 14:11 UTC (permalink / raw)
  To: glibc-bugs

Threaded applications that use malloc to allocate large buffer/work ares will
suffer significant performance degradation when ever the allocation size exceeds
the MMAP_THRESHOLD.

When a malloc allocation size exceeds the MMAP_THRESHOLD the storage is
allocated via anonymous mmap insted of from brt storage. The mmap syscal only
allocate the region, no pages are allocated until 1st touch. So there is page
fault for each page as it is touched for the 1st time. The kernel has a
semaphore around the "allocate zeroed page" operation which seriallizes this
operation for threaded applications. These anonymous mmap regions are not resued
by malloc so the "fault/zero page" bottleneck is ocurrs for every large allocation.

This can be seen as a kernel problem but it is also a glibc problem because for
some application the default MMAP_THRESHOLD (normally 128K) is simply too small.
Changing the MMAP_THRESHOLD to a value large enough to handle most allocations
gives a signicant speed up. 

For 64-bit platforms it could be wise to bump up the default thresholds to a
more reasonable value (say 16M). Or we need a simple and effective way to change
the thresholds from outside the applications. The mallopt API can used used to
change the default MMAP_THRESHOLD but many customers are reluctant to change
their source "just for Linux". And enviroment varible based mechansim may be
more acceptable.

-- 
           Summary: Poor threaded application performance when using malloc
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: sjmunroe at us dot ibm dot com
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=1541

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 11+ messages in thread
[parent not found: <bug-1541-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-05-28 19:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-25 14:11 [Bug libc/1541] New: Poor threaded application performance when using malloc sjmunroe at us dot ibm dot com
2005-10-25 15:32 ` [Bug libc/1541] " sjmunroe at us dot ibm dot com
2005-10-25 15:53 ` sjmunroe at us dot ibm dot com
2005-11-01  8:05 ` roland at gnu dot org
2005-11-01 17:12 ` sjmunroe at us dot ibm dot com
2005-11-01 17:19 ` sjmunroe at us dot ibm dot com
2005-11-01 17:27 ` sjmunroe at us dot ibm dot com
2007-02-18  4:45 ` drepper at redhat dot com
2010-06-01  3:30 ` pasky at suse dot cz
     [not found] <bug-1541-131@http.sourceware.org/bugzilla/>
2014-02-16 19:41 ` jackie.rosen at hushmail dot com
2014-05-28 19:46 ` schwab at sourceware dot org

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 read-only IMAP folder(s) and NNTP newsgroup(s).