RFR: 8297186: G1 triggers unnecessary full GCs when heap utilization is low
Thomas Schatzl
tschatzl at openjdk.org
Fri Nov 18 10:40:25 UTC 2022
On Fri, 18 Nov 2022 00:15:05 GMT, Man Cao <manc at openjdk.org> wrote:
>> Hi all,
>>
>> can I have reviews for this change that better enforces that after gc there is at least one eden region to allocate into?
>>
>> That avoids the problem described in the PR.
>>
>> Thanks,
>> Thomas
>
> src/hotspot/share/gc/g1/g1Policy.cpp line 283:
>
>> 281: uint desired_eden_length = MAX3(desired_eden_length_by_pause,
>> 282: desired_eden_length_by_mmu,
>> 283: MinDesiredEdenLength);
>
> Does this mean `G1Policy::calculate_young_desired_length()` could return 0 instead of a minimum of 1 now? Comment on line 228 may need updating.
>
> I noticed `young_list_desired_length()` is also used in `G1Policy::update_ihop_prediction()`. Could this change mess up with `_ihop_control->update_allocation_info()`?
No. Line 285 clamps the value to min/max of the young gen sizer; minimum size returned by it is 1 region, see `G1YoungSizer` code. So the original code to ensure a minimum region size of one has already been superfluous in the original implementation.
Since it serves no purpose, I removed it. I added an assertion at the end.
-------------
PR: https://git.openjdk.org/jdk/pull/11209
More information about the hotspot-gc-dev
mailing list