[PATCH] [v6] malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
Siddhesh Poyarekar
siddhesh@redhat.com
Tue Feb 24 07:01:00 GMT 2015
On Fri, Feb 20, 2015 at 01:27:47PM +0000, Mel Gorman wrote:
> 2015-02-10 Mel Gorman <mgorman@suse.de>
>
> [BZ #17195]
> * malloc/arena.c (free): Apply trim threshold to per-thread heaps
> as well as the main arena.
> ---
> malloc/arena.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/malloc/arena.c b/malloc/arena.c
> index 886defb074a2..fec339819309 100644
> --- a/malloc/arena.c
> +++ b/malloc/arena.c
> @@ -696,7 +696,7 @@ heap_trim (heap_info *heap, size_t pad)
> }
> top_size = chunksize (top_chunk);
> extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
> - if (extra < (long) pagesz)
> + if ((unsigned long) extra < mp_.trim_threshold)
> return 0;
>
> /* Try to shrink. */
Looks like this exposes some kind of a race. I ran the testsuite with
this patch and intl/tst-gettext4 and intl/tst-gettext5 fail with a
segfault. From a quick peek it looks like a malloc trying to tinker
with the part of an arena that has not yet been allocated, i.e. does
not have any permissions. Can you please look into it? I can't push
this till that problem is solved.
Thanks,
Siddhesh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150224/2f7d0c33/attachment.sig>
More information about the Libc-alpha
mailing list