RFR: 8297186: G1 triggers unnecessary full GCs when heap utilization is low

Thomas Schatzl tschatzl at openjdk.org
Fri Nov 18 10:43:26 UTC 2022


On Fri, 18 Nov 2022 10:38:10 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> 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.

> Thank you for the quick fix!
> 
> I haven't fully understood JDK-8253413 yet, so better to have someone more familiar with JDK-8253413 to review this change.

Feel free to ask if there is something you do not understand.

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

PR: https://git.openjdk.org/jdk/pull/11209


More information about the hotspot-gc-dev mailing list