8381566: G1: Concurrent refinement pre-sweep time logged as incorrect negative value#30551
8381566: G1: Concurrent refinement pre-sweep time logged as incorrect negative value#30551tabata-d wants to merge 4 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back dtabata! A progress list of the required criteria for merging this PR into |
|
@tabata-d 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: 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 75 new commits pushed to the
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 (@tschatzl, @albertnetymk) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
| State final_pre_sweep_state = (_state == State::SweepRT || _state == State::CompleteRefineWork) | ||
| ? State::SweepRT : _state; |
There was a problem hiding this comment.
I think the fix is fine, and it is expected that in this state (before sweep-rt) all time is credited to the pre-sweep phase.
However the name of the variable is very undescriptive to me (also it indicates to me that it contains state before sweepRT only, i.e. "pre"-sweeprt state) and the "final" prefix does not evoke much.
Starting the bike-shedding engine :) I would suggest something like refinement_state_bound[ed]_by_sweeprt/state_bound[ed]_by_sweeprt instead of the existing suggestion.
There was a problem hiding this comment.
Thanks for your comment.
I have fixed the name of the variable according to your suggestion.
| State state_bounded_by_sweeprt = (_state == State::SweepRT || _state == State::CompleteRefineWork) | ||
| ? State::SweepRT : _state; |
There was a problem hiding this comment.
| State state_bounded_by_sweeprt = (_state == State::SweepRT || _state == State::CompleteRefineWork) | |
| ? State::SweepRT : _state; | |
| State state_bounded_by_sweeprt = (_state == State::SweepRT || _state == State::CompleteRefineWork) | |
| ? State::SweepRT : _state; |
Indentation.
|
/integrate |
Fwiw, I almost wanted to mention it, Hotspot changes typically requires two reviewers, one capital "R" one (e.g. me) before pushes. :) Please have some additional patience. |
|
/reviewers 2 Thank you for letting me know! |
|
/sponsor |
|
Going to push as commit 31b5887.
Your commit was automatically rebased without conflicts. |
In certain application workloads, a Young GC may occur during G1 concurrent refinement. When this happens, the pre-sweep processing time is incorrectly logged as a negative value. This is a logging-only issue at the debug level.
Cause
The pre-sweep duration is calculated using the following logic:
This calculation expects the current concurrent refinement cycle to have already reached the
State::SweepRTstate by the time the log is generated. However, if a Young GC interrupts the process before reachingSweepRT, the last recorded timestamp forState::SweepRTbelongs to the previous refinement cycle.Consequently, the code calculates the difference between the
Idlestate of the current cycle and theSweepRTstate of the previous cycle, resulting in an incorrect negative duration.Proposed Fix
If the process has not yet reached
State::SweepRT, I propose logging the duration fromIdleto the current state. While this value will be identical to the "Refinement took" time and may offer limited additional insight, it is preferable to outputting misleading negative values. Furthermore, it remains consistent with the actual time spent in the pre-sweep phase up to that point.Alternative Considered
I considered outputting a specific message indicating that the pre-sweep did not complete (e.g., "pre-sweep not complete"). However, I decided against this to avoid duplicating large blocks of logging code, which would decrease maintainability.
Testing
:hotspot_gcgroup passed.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30551/head:pull/30551$ git checkout pull/30551Update a local copy of the PR:
$ git checkout pull/30551$ git pull https://git.openjdk.org/jdk.git pull/30551/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30551View PR using the GUI difftool:
$ git pr show -t 30551Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30551.diff
Using Webrev
Link to Webrev Comment