RFR: 8373714: Shenandoah: Register heuristic penalties following a degenerated GC

Kelvin Nilsen kdnilsen at openjdk.org
Tue Dec 16 14:53:41 UTC 2025


On Mon, 15 Dec 2025 23:53:30 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> Add a triggering penalty when we execute degenerated GC cycle.
>
> src/hotspot/share/gc/shenandoah/shenandoahDegeneratedGC.cpp line 314:
> 
>> 312:   ShenandoahCollectorPolicy* policy = heap->shenandoah_policy();
>> 313:   policy->record_degenerated(_generation->is_young(), _abbreviated, progress);
>> 314:   if (progress || (heap->mode()->is_generational() && !policy->generational_should_upgrade_degenerated_gc())) {
> 
> I'm not sure why we want to change the logic here. Previously, if there was no progress, and we were in generational mode and the policy said _not_ to upgrade to a full GC, nothing would happen here. Now we are treating that case the same as if there were progress, when there might not have been. `heap->notifiy_gc_progress()`  resets the `no progress counter`, which has implications for how many times Shenandoah will retry allocations. We need to be careful to avoid an allocation loop that just runs degenerated cycles forever (brownout).

This "avoids" a third arm of the if-then-else (rather than if-then-else-if-then-else-if).  In the case that we do upgrade to full gc, we'll experience a full-gc penalty.  In the case that we do not upgrade to full-gc following failed degen progress, we need "somehow" to incur the degen penalty.  This is how I proposed to do that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28834#discussion_r2623601570


More information about the hotspot-gc-dev mailing list