8381566: G1: Concurrent refinement pre-sweep time logged as incorrect negative value#30551
Open
tabata-d wants to merge 2 commits intoopenjdk:masterfrom
Open
8381566: G1: Concurrent refinement pre-sweep time logged as incorrect negative value#30551tabata-d wants to merge 2 commits intoopenjdk:masterfrom
tabata-d wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back dtabata! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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