glibc/malloc
Carlos O'Donell e4bc326dbb malloc: Consistently apply trim_threshold to all heaps (Bug 17195)
In the per-thread arenas we apply trim_threshold-based checks
to the extra space between the pad and the top_area. This isn't
quite accurate and instead we should be harmonizing with the way
in which trim_treshold is applied everywhere else like sysrtim
and _int_free. The trimming check should be based on the size of
the top chunk and only the size of the top chunk. The following
patch harmonizes the trimming and make it consistent for the main
arena and thread arenas.

In the old code a large padding request might have meant that
trimming was not triggered. Now trimming is considered first based
on the chunk, then the pad is subtracted, and the remainder trimmed.
This is how all the other trimmings operate. I didn't measure the
performance difference of this change because it corrects what I
consider to be a behavioural anomaly. We'll need some profile driven
optimization to make this code better, and even there Ondrej and
others have better ideas on how to speedup malloc.

Tested on x86_64 with no regressions. Already reviewed by Siddhesh
Poyarekar and Mel Gorman here and discussed here:
https://sourceware.org/ml/libc-alpha/2015-05/msg00002.html
2015-10-07 22:21:36 -04:00
..
arena.c malloc: Consistently apply trim_threshold to all heaps (Bug 17195) 2015-10-07 22:21:36 -04:00
Depend
hooks.c Fix for test "malloc_usable_size: expected 7 but got 11" 2015-05-19 12:10:26 -07:00
Makefile Avoid deadlock in malloc on backtrace (BZ #16159) 2015-05-19 06:40:38 +05:30
malloc.c Use ALIGN_DOWN in systrim. 2015-09-14 15:32:47 -04:00
malloc.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
mallocbug.c Reformat malloc to gnu style. 2014-01-02 09:40:10 +01:00
mcheck-init.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
mcheck.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
mcheck.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
memusage.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
memusage.sh Update copyright dates not handled by scripts/update-copyrights. 2015-01-02 16:54:45 +00:00
memusagestat.c Update copyright dates not handled by scripts/update-copyrights. 2015-01-02 16:54:45 +00:00
morecore.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
mtrace.c Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912). 2015-09-08 21:11:03 +00:00
mtrace.pl Filter out NULL entries. 2015-09-01 08:35:38 -07:00
obstack.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
obstack.h Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
scratch_buffer_grow_preserve.c scratch_buffer_grow_preserve: Add missing #include <string.h> 2015-04-07 17:46:58 +02:00
scratch_buffer_grow.c Add struct scratch_buffer and its internal helper functions 2015-04-07 11:03:43 +02:00
scratch_buffer_set_array_size.c Add struct scratch_buffer and its internal helper functions 2015-04-07 11:03:43 +02:00
set-freeres.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
thread-freeres.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-calloc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-malloc-backtrace.c Avoid outputting to TTY after an expected memory corruption in testcase 2015-06-05 09:39:49 -03:00
tst-malloc-usable.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-malloc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-mallocfork.c
tst-mallocstate.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-mallopt.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-mcheck.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-memalign.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-mtrace.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-mtrace.sh Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-obstack.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-posix_memalign.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-pvalloc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-realloc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
tst-scratch_buffer.c scratch_buffer: Suppress truncation warning on 32-bit 2015-04-09 17:12:42 +02:00
tst-trim1.c
tst-valloc.c Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Versions Add struct scratch_buffer and its internal helper functions 2015-04-07 11:03:43 +02:00