Message ID | 20150608103743.GN26425@suse.de |
---|---|
State | New |
Headers | show |
Mel Gorman <mgorman@suse.de> writes: > diff --git a/malloc/arena.c b/malloc/arena.c > index 2466697d1aa7..b932574ccaf8 100644 > --- a/malloc/arena.c > +++ b/malloc/arena.c > @@ -698,6 +698,9 @@ heap_trim (heap_info *heap, size_t pad) > /* Uses similar logic for per-thread arenas as the main arena with systrim > by preserving the top pad and at least a page. */ > top_size = chunksize (top_chunk); > + if (top_size == MINSIZE) > + return 0; > + > top_area = top_size - MINSIZE - 1; > if (top_area <= pad) > return 0; > For rebustness I'd check for top_area < 0 instead. Andreas.
diff --git a/malloc/arena.c b/malloc/arena.c index 2466697d1aa7..b932574ccaf8 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -698,6 +698,9 @@ heap_trim (heap_info *heap, size_t pad) /* Uses similar logic for per-thread arenas as the main arena with systrim by preserving the top pad and at least a page. */ top_size = chunksize (top_chunk); + if (top_size == MINSIZE) + return 0; + top_area = top_size - MINSIZE - 1; if (top_area <= pad) return 0;