45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
Revert the following fix temporarily:
|
|
|
|
commit c26efef9798914e208329c0e8c3c73bb1135d9e3
|
|
Author: Mel Gorman <mgorman@suse.de>
|
|
Date: Thu Apr 2 12:14:14 2015 +0530
|
|
|
|
malloc: Consistently apply trim_threshold to all heaps [BZ #17195]
|
|
|
|
|
|
because it makes an openjdk bug (#1209451) more prominent, crashing java
|
|
commands.
|
|
|
|
diff --git a/malloc/arena.c b/malloc/arena.c
|
|
index 8af51f0..d85f371 100644
|
|
--- a/malloc/arena.c
|
|
+++ b/malloc/arena.c
|
|
@@ -658,7 +658,7 @@ heap_trim (heap_info *heap, size_t pad)
|
|
unsigned long pagesz = GLRO (dl_pagesize);
|
|
mchunkptr top_chunk = top (ar_ptr), p, bck, fwd;
|
|
heap_info *prev_heap;
|
|
- long new_size, top_size, extra, prev_size, misalign;
|
|
+ long new_size, top_size, top_area, extra, prev_size, misalign;
|
|
|
|
/* Can this heap go away completely? */
|
|
while (top_chunk == chunk_at_offset (heap, sizeof (*heap)))
|
|
@@ -694,9 +694,16 @@ heap_trim (heap_info *heap, size_t pad)
|
|
set_head (top_chunk, new_size | PREV_INUSE);
|
|
/*check_chunk(ar_ptr, top_chunk);*/
|
|
}
|
|
+
|
|
+ /* 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);
|
|
- extra = (top_size - pad - MINSIZE - 1) & ~(pagesz - 1);
|
|
- if (extra < (long) pagesz)
|
|
+ top_area = top_size - MINSIZE - 1;
|
|
+ if (top_area <= pad)
|
|
+ return 0;
|
|
+
|
|
+ extra = ALIGN_DOWN(top_area - pad, pagesz);
|
|
+ if ((unsigned long) extra < mp_.trim_threshold)
|
|
return 0;
|
|
|
|
/* Try to shrink. */
|