Skip to content

Conversation

@caoman
Copy link
Contributor

@caoman caoman commented Dec 10, 2025

Hi all,

Could anyone review this test-only improvement to make TestG1ClassUnloadingHWM.java more robust in various configurations?
See https://bugs.openjdk.org/browse/JDK-8373403 for more details.

-Man


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-8373403: [TESTBUG] TestG1ClassUnloadingHWM.java could fail with large G1HeapRegionSize and small InitialHeapSize (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28738

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 10, 2025

👋 Welcome back manc! 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 Dec 10, 2025

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

8373403: [TESTBUG] TestG1ClassUnloadingHWM.java could fail with large G1HeapRegionSize and small InitialHeapSize

Reviewed-by: tschatzl, iwalulya

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 23 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
Copy link

openjdk bot commented Dec 10, 2025

@caoman The following label will be automatically applied to this pull request:

  • hotspot-gc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. 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 Dec 10, 2025
@mlbridge
Copy link

mlbridge bot commented Dec 10, 2025

Webrevs

@walulyai
Copy link
Member

The issue appears to be that we compute an IHOP target threshold that is smaller than the G1HeapRegionSize. So after the "Pause Full (Metadata GC Threshold)", a concurrent cycle is requested.

Would it be better to fix that as below?

--- a/src/hotspot/share/gc/g1/g1IHOPControl.cpp
+++ b/src/hotspot/share/gc/g1/g1IHOPControl.cpp
@@ -115,7 +115,7 @@ size_t G1IHOPControl::get_conc_mark_start_threshold() {
   guarantee(_target_occupancy > 0, "Target occupancy must be initialized");
 
   if (!_is_adaptive || !have_enough_data_for_prediction()) {
-    return (size_t)(_initial_ihop_percent * _target_occupancy / 100.0);
+    return MAX2((size_t)(_initial_ihop_percent * _target_occupancy / 100.0), G1HeapRegionSize);
   }

@tschatzl
Copy link
Contributor

I think this is a test bug: it should check whether the Metadata GCs is a full gc and not a young gc starting a concurrent mark. Right now the test just checks whether there is any full gc and not a concurrent start gc at all. The regexp should add a Metadata GC Threshold part there.

@walulyai' s comment hints at another issue: if there is only one region, there is no gain in collecting that region (unless, very unlikely, that single region is completely empty). Either the concurrent mark will select it as an evacuation candidate and copy its contents to another (single) region, or do nothing.

Either way nothing is gained. However this is a different issue imo.

@caoman
Copy link
Contributor Author

caoman commented Dec 10, 2025

I think this is a test bug: it should check whether the Metadata GCs is a full gc and not a young gc starting a concurrent mark. Right now the test just checks whether there is any full gc and not a concurrent start gc at all. The regexp should add a Metadata GC Threshold part there.

Updated test to check Metadata GC Threshold explicitly, and removed the check for concurrent mark in testWithoutG1ClassUnloading().

Also filed https://bugs.openjdk.org/browse/JDK-8373461 for avoiding the unnecessary concurrent mark.

@tschatzl
Copy link
Contributor

Updated test to check Metadata GC Threshold explicitly, and removed the check for concurrent mark in testWithoutG1ClassUnloading().

One can check whether the concurrent start GC has the "Metadata GC Threshold" cause as well in the regexes. Young GC both have the cause (e.g. that "Metadata GC Threshold") as well as a type ("Concurrent Start").

Also filed https://bugs.openjdk.org/browse/JDK-8373461 for avoiding the unnecessary concurrent mark.

Thank you.

@caoman
Copy link
Contributor Author

caoman commented Dec 11, 2025

One can check whether the concurrent start GC has the "Metadata GC Threshold" cause as well in the regexes. Young GC both have the cause (e.g. that "Metadata GC Threshold") as well as a type ("Concurrent Start").

Thanks, done. Now we can keep the check in testWithoutG1ClassUnloading() for non-existence of Pause Young (Concurrent Start) (Metadata GC Threshold).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 12, 2025
Copy link
Member

@walulyai walulyai 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!

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

Labels

hotspot-gc [email protected] 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.

3 participants