RFR: 8348595: GenShen: Fix generational free-memory no-progress check [v2]
Paul Hohensee
phh at openjdk.org
Mon Feb 10 18:44:13 UTC 2025
On Fri, 7 Feb 2025 23:56:56 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:
>> src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp line 52:
>>
>>> 50: size_t free_actual = free_set->available();
>>> 51: // The sum of free_set->capacity() and ->reserved represents capacity of young in generational, heap in non-generational.
>>> 52: size_t free_expected = ((free_set->capacity() + free_set->reserved()) / 100) * ShenandoahCriticalFreeThreshold;
>>
>> As an outsider, the units involved and what exactly is being calculated is pretty opaque. Why would we divide by 100 to compute free_expected and not do the same for free_actual? Do we care about integer division truncation? The default value of ShenandoahCriticalFreeThreshold is 1, so multiplying by it is a nop by default, which seems strange.
>
> ShenandoahCriticalFreeThreshold represents a percentage of the "total size". To calculate N% of the young generation size, we divide the generation size by 100 and then multiply by ShenandoahCriticalFreeThreshold. This code is a bit different in the most recent revision. Do you think it needs a comment?
Yes :)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23306#discussion_r1949689186
More information about the shenandoah-dev
mailing list