RFR: 8346920: Serial: Support allocation in old generation when heap is almost full

Stefan Johansson sjohanss at openjdk.org
Fri Jan 24 09:08:54 UTC 2025


On Thu, 23 Jan 2025 15:12:08 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> This PR restores the support for allocation in old-gen when heap is almost full, detected as non-empty young-gen after full gc, which was removed by mistake in [JDK-8333786](https://bugs.openjdk.org/browse/JDK-8333786). With this change, the benchmark attached to the ticket now completes in ~13 GC.
> 
> Test: tier1-5

Looks good, just a few suggestions.

src/hotspot/share/gc/serial/serialHeap.cpp line 293:

> 291:   return    (word_size > heap_word_size(young_capacity))
> 292:          || GCLocker::is_active_and_needs_gc()
> 293:          || _is_heap_almost_full;

Maybe update the comment above to be even more accurate.

src/hotspot/share/gc/serial/serialHeap.hpp line 103:

> 101:   // will attempt some uncommon measures, e.g. alllocating small objs in
> 102:   // old-gen.
> 103:   bool _is_heap_almost_full;

I'm not to fond of the `heap` part of the name since it lives in `SerialHeap`, but just calling it `_is_almost_full` will look strange since we also have the parameter `full` where it is used. 

What do you think about calling it something like `_allow_old_gen_allocation` instead?

-------------

Marked as reviewed by sjohanss (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/23270#pullrequestreview-2572069193
PR Review Comment: https://git.openjdk.org/jdk/pull/23270#discussion_r1928350924
PR Review Comment: https://git.openjdk.org/jdk/pull/23270#discussion_r1928357467


More information about the hotspot-gc-dev mailing list