-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8352588: GenShen: Enabling JFR asserts when getting GCId #24166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/issue JDK-8352588 |
|
👋 Welcome back xpeng! A progress list of the required criteria for merging this PR into |
|
@pengxiaolong 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 68 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 (@earthling-amzn, @ysramakrishna) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
|
@pengxiaolong This issue is referenced in the PR title - it will now be updated. |
|
@pengxiaolong The following labels will be automatically applied to this pull request:
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. |
Webrevs
|
| return Atomic::load(&_gc_count); | ||
| } | ||
|
|
||
| size_t ShenandoahController::get_gc_id() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to keep this method? Can't everything just use get_gc_count now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to keep it, it needs a bit more changes to touch up. I think it better to remove it to avoid the confusion with the gc_id() method,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed method ShenandoahController::get_gc_id() in the update.
| "At end of Concurrent Young GC"; | ||
| if (_heap->collection_set()->has_old_regions()) { | ||
| mmu_tracker->record_mixed(get_gc_id()); | ||
| mmu_tracker->record_mixed(gc_id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be get_gc_count now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we always use gc id for MMUTracker? Although the internal gc counter of Shenandoah is also fine here.
I'm ok to change it back to get_gc_count, but will also update the declaration of the relevant methods like below to make them consistent:
void record_global(size_t gc_count)
|
Removed all code related to the refactor of henandoahController::_gc_id, now the change should be a pure fix for the bug. |
|
I haven't started reviewing, but in cases where we have a "mark" (a thread local stack scoped constant variable, such as used for logging etc.) and an under;ying "true value", the expectation is that the "mark" is a snapshot of the "true", and represents a label for the work being done in that specific scope. Once you keep this model/idiom in mind, the code should become clean, and the same 0-based conventions should cleanly apply. I hope to review the code soon'ish. Sorry for the delay. |
This would be by design and, as you discovered, was because a suitable GCIdMark scope was missing which would have supplied the correct ID. It is important that the JFR event issues from the intended scope for the corresponding ID for which the metrics/event are being generated. In particular, if there are multiple concurrent GC ID's in progress, with a common pool of worker threads that multiplex this work, any appropriate event metrics should be correctly attributed to the right ID in question. I am making general comments here without knowledge of the specific details, sorry! :-) |
Thank you @ysramakrishna for reviewing the PR, appreciate it! Yes, it is a simple bug related to the GCIdMark scope, so the fix is to make sure GCIdMark scope is correct. For common pool of worker threads, each thread should copy the gc_id to local with the constructor GCIdMark(gc_id), there some existing examples doing this in hotspot, e.g. https://github.com/openjdk/jdk/blob/master/src/hotspot/share/gc/shared/workerThread.cpp#L68 |
earthling-amzn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ysramakrishna
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
|
/integrate |
|
Thanks for the reviews and suggestions! |
|
@pengxiaolong |
|
/sponsor |
|
Going to push as commit a2a64da.
Your commit was automatically rebased without conflicts. |
|
@phohensee @pengxiaolong Pushed as commit a2a64da. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Root cause
Shenandoah has its own way to generate gc id(link, link), but when it runs a specific GC cycle, it still use the default GCIdMark(link) to generate a gc id and set it to NamedThread::_gc_id. Once the specific GC cycle finishes, the NamedThread::_gc_id is restored to the original value which is
undefined, which causes the asserts when Enabling JFR, in release build it should cause invalid GC id in some of JFR events.Solution
it is confusing that Shenandoah generates its own gc id but not use it for GC logging and JFR, the solution is fairly simple, the control thread just need inject gc id with GCIdMark(gc_id) it generates in
ShenandoahControlThread::run_serviceandShenandoahGenerationalControlThread::run_gc_cycleIn the test, I also noticed the value of gc_id generated by Shenandoah control thread starts from 1, which is different from the default behavior of GCIdMark which generates id starting from 0, this PR will also fix it.
Test
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24166/head:pull/24166$ git checkout pull/24166Update a local copy of the PR:
$ git checkout pull/24166$ git pull https://git.openjdk.org/jdk.git pull/24166/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24166View PR using the GUI difftool:
$ git pr show -t 24166Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24166.diff
Using Webrev
Link to Webrev Comment