This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [v5] malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
- From: Mel Gorman <mgorman at suse dot de>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: libc-alpha at sourceware dot org, Julian Taylor <jtaylor dot debian at googlemail dot com>, Carlos O'Donell <carlos at redhat dot com>, Rik van Riel <riel at redhat dot com>, KOSAKI Motohiro <kosaki dot motohiro at gmail dot com>, Konstantin Serebryany <kcc at google dot com>, Minchan Kim <minchan dot kim at gmail dot com>
- Date: Fri, 20 Feb 2015 13:17:43 +0000
- Subject: Re: [PATCH] [v5] malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
- Authentication-results: sourceware.org; auth=none
- References: <20150219104205 dot GH23372 at suse dot de> <20150220124419 dot GS1594 at spoyarek dot pnq dot redhat dot com>
On Fri, Feb 20, 2015 at 06:14:20PM +0530, Siddhesh Poyarekar wrote:
> On Thu, Feb 19, 2015 at 10:42:05AM +0000, Mel Gorman wrote:
> > 2015-02-19 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 | 25 +++++++++++++------------
> > 1 file changed, 13 insertions(+), 12 deletions(-)
> >
> > diff --git a/malloc/arena.c b/malloc/arena.c
> > index 886defb074a2..cdb4e900a66a 100644
> > --- a/malloc/arena.c
> > +++ b/malloc/arena.c
> > @@ -696,20 +696,21 @@ 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)
> > - return 0;
> > -
> > - /* Try to shrink. */
> > - if (shrink_heap (heap, extra) != 0)
> > - return 0;
> > + if (extra >= (long) mp_.trim_threshold)
>
> Cast EXTRA to unsigned long instead. The above will break if trimming
> is disabled since it will always trim instead.
>
> Why did you change the condition BTW? The earlier one-line change was
> nicer and only needed to have the cast fixed.
>
Only because it matched similar logic on the main arena.
--
Mel Gorman
SUSE Labs