Skip to content

8212084: G1: Implement UseGCOverheadLimit#2682

Open
marschall wants to merge 6 commits intoopenjdk:masterfrom
marschall:backport-8212084
Open

8212084: G1: Implement UseGCOverheadLimit#2682
marschall wants to merge 6 commits intoopenjdk:masterfrom
marschall:backport-8212084

Conversation

@marschall
Copy link
Copy Markdown

@marschall marschall commented Mar 17, 2026

Backport JDK-8212084 to JDK-21.

I am new to backporting JDK fixes. I have contributed small fixes to OpenJDK upstream in the past but this is my first backport, so any help is appreciated, especially as I do not have JBS access.

JDK-8212084 has been backported to OpenJDK 25 in JDK-8374125. So far it has only made it into the Oracle versions of JDK 21 and JDK 17. I believe this confirms that backporting JDK-8212084 provides value with acceptable risk.

Why am I backporting this? We are using G1 on OpenJDK 21 and are observing an issue that we believe is caused by GC overhead (high CPU usage on all cores, application becomes unresponsive and is eventually terminated due to failing liveness probes). Unfortunately we do not yet have the tools in place to confirm this, although we are working on this. With UseGCOverheadLimit the application would terminate earlier with a clear error message and we could make use of HeapDumpOnOutOfMemoryError for diagnosing.

I split this PR into 5 commits for easier reviewing:

  • Apply the commit from JDK-8374125 and fix the merge conflicts, these are just positioning issues due to white space, log statements and comments.
  • Make the code compile for older G1 before https://github.com/openjdk/jdk/pull/25408/changes, I am almost, but not 100%, certain that num_available_regions is the replacement for num_free_or_available_regions.
  • Remove -XX:-UseCompactObjectHeaders from TestUseGCOverheadLimit as this feature is not in OpenJDK 21. Therefore the test behaves the same in JDK 21 without the option as in JDK 25 with the compact object headers disabled.
  • Update the copyright years.
  • Revert update the copyright years.

I ran both the tier1 and tier2 test suites, the both pass, specifically TestUseGCOverheadLimit.



Progress

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

Issue

  • JDK-8212084: G1: Implement UseGCOverheadLimit (Enhancement - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2682/head:pull/2682
$ git checkout pull/2682

Update a local copy of the PR:
$ git checkout pull/2682
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2682/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2682

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2682.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link
Copy Markdown

bridgekeeper Bot commented Mar 17, 2026

👋 Welcome back marschall! 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
Copy Markdown

openjdk Bot commented Mar 17, 2026

@marschall 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:

8212084: G1: Implement UseGCOverheadLimit

Reviewed-by: phh, rrich

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

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@phohensee, @reinrich) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk Bot changed the title Backport 8212084 8212084: G1: Implement UseGCOverheadLimit Mar 17, 2026
@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 17, 2026

This backport pull request has now been updated with the original issue, but not the original commit. If you have the original commit hash, please update the pull request title with Backport <hash>.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Mar 17, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge Bot commented Mar 17, 2026

Webrevs

Copy link
Copy Markdown
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

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

Please remove the copyright date updates from the updated files. For backports, only use copyright date updates that are in the original commit. Other than that, lgtm.

@marschall
Copy link
Copy Markdown
Author

Can do. I assume adding a revert commit rather than a reset and force push. Will the JIRA be created automatically? I do not have access to JBS.

@tstuefe
Copy link
Copy Markdown
Member

tstuefe commented Mar 24, 2026

With a change like this, I would also ask the original authors for reviews.

@phohensee
Copy link
Copy Markdown
Member

You can just add a commit to revert the copyright updates to your fork, and then push. The upstream commit bot will squash commits to your fork.

@phohensee
Copy link
Copy Markdown
Member

Also, please enable GHA testing on your fork.

@phohensee
Copy link
Copy Markdown
Member

@tschatzl, would you pls review?

This reverts commit 910f34d.
@marschall
Copy link
Copy Markdown
Author

I reverted the copyright year changes and enabled tests on my fork. Can I trigger the tests or do some of you have to do this?

@phohensee
Copy link
Copy Markdown
Member

You can push a commit to trigger the checks, or trigger them manually (upper right of the Actions page).

Copy link
Copy Markdown
Member

@reinrich reinrich left a comment

Choose a reason for hiding this comment

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

Changes look good to me.
Cheers, Richard.

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Mar 30, 2026

⚠️ @marschall This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@marschall
Copy link
Copy Markdown
Author

/approval

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 2, 2026

@marschall usage: /approval [<id>] (request|cancel) [<text>]

@marschall
Copy link
Copy Markdown
Author

/approval request

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 2, 2026

@marschall
8212084: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Apr 2, 2026
@GoeLin
Copy link
Copy Markdown
Member

GoeLin commented Apr 7, 2026

HI @marschall
with your approval request you should give a comment that covers reason, risk, testing and similarity to the source change. I'll apporve it although this is missing as I know the change well and think we should have it in 21 to have the same behaviour as the Oracle JDK.
I would appreciate if you add this reason, you can simply issue the /approval command again with the comment text. It replaces the text in the JBS issue.

@openjdk openjdk Bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Apr 7, 2026
@marschall
Copy link
Copy Markdown
Author

@GoeLin very well, I’m on vacation right now. I’ll cancel the request for now and reopen with a comment once I’m back.

@marschall
Copy link
Copy Markdown
Author

/approval cancel

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 11, 2026

@marschall
8212084: The request has already been handled by a maintainer and can no longer be canceled.

@GoeLin
Copy link
Copy Markdown
Member

GoeLin commented Apr 16, 2026

Hi @marschall
Please issue /template append
and then click the checkbox about AI that was added in the description at the beginning of the PR.
Thanks.

@marschall
Copy link
Copy Markdown
Author

/template append

@openjdk
Copy link
Copy Markdown

openjdk Bot commented Apr 17, 2026

@marschall The pull request template has been appended to the pull request body

@openjdk openjdk Bot added ready Pull request is ready to be integrated rfr Pull request is ready for review and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base ready Pull request is ready to be integrated rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

5 participants