RFR: 8338977: Parallel: Improve heap resizing heuristics [v2]
Guoxiong Li
gli at openjdk.org
Sun May 18 12:20:51 UTC 2025
On Fri, 16 May 2025 07:27:56 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 343:
>>
>>> 341: if (is_gc_overhead_limit_reached()) {
>>> 342: return nullptr;
>>> 343: }
>>
>> It seems the parameter `gc_overhead_limit_was_exceeded` and the field `MemAllocator::Allocation::_overhead_limit_exceeded` are not used by all GCs now. Should we keep the parameter and set it as `true` under the condition `is_gc_overhead_limit_reached()`? For example:
>>
>>
>> if (op.prologue_succeeded()) {
>> assert(is_in_or_null(op.result()), "result not in heap");
>> if (is_gc_overhead_limit_reached()) {
>> *gc_overhead_limit_was_exceeded = true;
>> return nullptr;
>> }
>> return op.result();
>> }
>>
>>
>> Or we should remove the parameter and the field in another PR.
>
> Since this is not implemented by any other GCs, I think it's best to remove it in a follow-up PR.
Filed https://bugs.openjdk.org/browse/JDK-8357188
>> src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 862:
>>
>>> 860: resize_old_gen_after_full_gc();
>>> 861: young_gen()->resize_after_full_gc();
>>> 862: }
>>
>> The `PSYoungGen` has its methods `resize_after_full_gc` and `resize_after_young_gc`. I think such design is good. What about moving the method `resize_old_gen_after_full_gc` (and the related method `calculate_desired_old_gen_capacity`) to `PSOldGen` and renaming it as `resize_after_full_gc`?
>
> `resize_old_gen_after_full_gc` contains some logic around `MinHeapFreeRatio` that makes it unsuitable to be placed inside old-gen, IMO. Given there is on-going work/discussion on removing/limiting MinHeapFreeRatio in https://bugs.openjdk.org/browse/JDK-8353716 in G1, I think we don't need to optimize for the structure too much, as it will probably be changed soon.
OK
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25000#discussion_r2094507209
PR Review Comment: https://git.openjdk.org/jdk/pull/25000#discussion_r2094507227
More information about the hotspot-dev
mailing list