RFR: 8332516: Serial: Always sample promoted bytes to avoid getting stuck in Full GCs
Thomas Schatzl
tschatzl at openjdk.org
Mon Jun 3 10:58:02 UTC 2024
On Wed, 29 May 2024 09:34:18 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/serial/tenuredGeneration.cpp line 398:
>>
>>> 396: promoted_in_bytes = used_after_gc - _used_at_prologue;
>>> 397: } else {
>>> 398: promoted_in_bytes = 0;
>>
>> Question about this new code vs. the old code:
>>
>> So the changed code updates promotion statistics in old gen also during full gc now. The amount of "promotion" is the difference of used in old gen after and before.
>>
>> I am not sure this is a good idea as the full gc also reduces the amount of existing old gen live objects. Using `0` in that case (if the full gc collects more than the implicit collection of the young gen during full collection) also seems dodgy at best.
>>
>> If my reading of the code is correct and there isn't a way to correctly measure the amount of live objects in young gen during full gc I would prefer to just not update the promotion counter during full gc.
>>
>> Also consider "extra" full gcs like System.gc() calls and other causes for full gc that can happen at any time - they only seem to add noise to the promoted bytes sampling.
>
> The new logic updates promoted-bytes metric on every gc, keeping it up to date at best effort. Not updating it can result into using outdated info in deciding whether to young-gc or full-gc. The bm in https://bugs.openjdk.org/browse/JDK-8320165 shows that one can struck in full-gc forever due to this outdated metric.
Thanks for the clarification.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19306#discussion_r1624219990
More information about the hotspot-gc-dev
mailing list