RFR:(XS): Small enhancement for large allocation
Aleksey Shipilev
shade at redhat.com
Fri Dec 16 14:48:42 UTC 2016
On 12/16/2016 03:40 PM, Zhengyu Gu wrote:
> When large allocation fails, current implementation only grows heap by 1 and
> retry. This is slightly inefficient.
> We can grow the heap by required regions at once, to avoid unnecessary loop.
>
> http://cr.openjdk.java.net/~zgu/shenandoah/large_alloc/webrev.00/
Been meaning to fix that! Shouldn't we instead fix the logic in
ShenandoahHeap::allocate_memory_work, and not try to do another grow_heap_by in
downcall to allocate_memory_under_lock -> allocate_large_memory?
HeapWord* ShenandoahHeap::allocate_memory_work(size_t word_size) {
ShenandoahHeapLock heap_lock(this);
HeapWord* result = allocate_memory_under_lock(word_size);
while (result == NULL && _num_regions < _max_regions) {
grow_heap_by(1); // <--- depend on word_size here
result = allocate_memory_under_lock(word_size);
}
return result;
}
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list