Skip to content

8377180: Shenandoah: make escalation from degen to full more conservative#29574

Open
kdnilsen wants to merge 4 commits intoopenjdk:masterfrom
kdnilsen:delay-escalation-to-full-with-traditional-shenandoah
Open

8377180: Shenandoah: make escalation from degen to full more conservative#29574
kdnilsen wants to merge 4 commits intoopenjdk:masterfrom
kdnilsen:delay-escalation-to-full-with-traditional-shenandoah

Conversation

@kdnilsen
Copy link
Contributor

@kdnilsen kdnilsen commented Feb 4, 2026

This PR merges into Traditional Shenandoah an optimization that was applied to Generational Shenandoah in September 2025 and has proven itself effective in that context. See #27456

The change is to not immediately escalate Degenerated GC to Full GC following "bad progress" by Degen GC. The most common reason for bad degenerated progress is that most of the potential garbage was created following the start of the concurrent GC cycle which degenerated. This "floating" garbage cannot be reclaimed by the degenerated cycle because of the SATB protocol.

Pursuing at least one additional concurrent cycle, even if that subsequent concurrent GC degenerates, is usually a much better approach than forcing immediate escalation to Full GC. While escalation to full GC will resolve the out-of-memory condition, it imposes unnecessarily long stop-the-world pauses:

   Existing behavior not to scale:
       <- [       Conc GC       ] -> <- [ Degen    ] -> <- [            Full GC             ]
          [    experiences      ]       [  with    ]
          [     allocation      ]       [   bad    ]
          [      failure        ]       [ progress ]
                                        [ STW pause is 100 ms degen + 3s full GC            ]

   Revised behavior not to scale:
       <- [       Conc GC       ] -> <- [ Degen    ] -> <- [       Conc GC       ] -> [ Degen    ]
          [    experiences      ]       [  with    ]       [    experiences      ]    [  with    ]
          [     allocation      ]       [   bad    ]       [     allocation      ]    [  good    ]
          [      failure        ]       [ progress ]       [      failure        ]    [ progress ]
                                        [  100 ms  ]                                  [  100 ms  ] 
                                        [   pause  ]                                  [   pause  ]


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8377180: Shenandoah: make escalation from degen to full more conservative (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29574/head:pull/29574
$ git checkout pull/29574

Update a local copy of the PR:
$ git checkout pull/29574
$ git pull https://git.openjdk.org/jdk.git pull/29574/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29574

View PR using the GUI difftool:
$ git pr show -t 29574

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29574.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 4, 2026

👋 Welcome back kdnilsen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 4, 2026

@kdnilsen This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8377180: Shenandoah: make escalation from degen to full more conservative

Reviewed-by: wkemper, xpeng

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 34 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Feb 4, 2026
@openjdk
Copy link

openjdk bot commented Feb 4, 2026

@kdnilsen The following labels will be automatically applied to this pull request:

  • hotspot-gc
  • shenandoah

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 4, 2026
@mlbridge
Copy link

mlbridge bot commented Feb 4, 2026

Webrevs

Copy link
Contributor

@earthling-amzn earthling-amzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, suggest one small change.

// Genshen will only upgrade to a full gc after the configured number of futile degenerated cycles.
bool generational_should_upgrade_degenerated_gc() const {
bool should_upgrade_degenerated_gc() const {
return _consecutive_degenerated_gcs_without_progress >= GENERATIONAL_CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we rename GENERATIONAL_CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD as well? Perhaps CONSECUTIVE_BAD_DEGEN_PROGRESS_THRESHOLD?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 5, 2026
Copy link

@pengxiaolong pengxiaolong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Traditional Shenandoah will have same upgrade policy as Genshen with the change.
Looks good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-gc hotspot-gc-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review shenandoah shenandoah-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants