-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8280917: Simplify G1ConcurrentRefineThread activation #7282
Conversation
👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into |
@kimbarrett The following label 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 list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
// the primary thread if needed. Non-GC safepoints are expected to | ||
// rarely (if ever) dirty cards, so defer activation to a post-safepoint | ||
// notification. | ||
if (SafepointSynchronize::is_at_safepoint()) { |
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.
@walulyai noticed that this test was backward. Difference in testing is often surprisingly subtle, I suspect because there's enough other wonkiness in the refinement thread control to often mask the effect. This change as a whole is intended as a step toward fixing that. I'm sure glad Ivan spotted this now though.
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 re-ran tests and ran some additional with this mistake fixed. No problems encountered. I also did some better performance testing. specjbb2015 with options that will trigger the need for more concurrent refinement was unchanged between baseline and with the above fixed. Having the test backward produced a 6-7% regression. Thanks again Ivan.
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!
@kimbarrett 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 1 new commit pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
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.
Looks good, just a couple of small comments.
|
||
// Called when no refinement work found for this thread. | ||
// Returns true if should deactivate. | ||
bool maybe_deactivate(bool more_work); | ||
// precondition: this is the current thread. | ||
virtual bool maybe_deactivate() = 0; |
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 know the name is pre-existing, but I've always found the naming it a bit odd. Or we usually call thing like this should_deactivate()
. If you prefer keeping the old name I'm fine with it, just wanted to mention it since we are changing the code.
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'm not especially fond that name, but a should_
prefix would incorrectly suggest it's "just" a predicate, but it has side effects. I have some further changes coming that might do things a bit differently. I'll keep the naming in mind.
class G1PrimaryConcurrentRefineThread final : public G1ConcurrentRefineThread { | ||
Semaphore _notifier; | ||
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, 0); | ||
volatile size_t _threshold; |
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.
Might make sense to add some additional comment for the threshold, similar to the description you have in the PR summary:
The primary thread uses an atomic activation threshold that also serves as "is
running" state. This activation threshold is used by the write barrier
support to determine whether the thread's semaphore needs to be signaled.
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 meant to do that, and then forgot. Thanks for point it out. I'll add it before pushing.
/integrate |
@kimbarrett Pushed as commit 861f279. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this change to to G1ConcurrentRefineThreads to simplify the
activation mechanism.
We split the class into two subclasses, one for the "primary" refinement
thread and another class for the remaining refinement threads.
The secondary threads are changed to use Monitor-based waits and notifications
with a supporting request flag.
The primary thread uses an atomic activation threshold that also serves as "is
running" state. This activation threshold is used by the write barrier
support to determine whether the thread's semaphore needs to be signaled.
That threshold is now in the primary refinement thread rather than in the
dirty card queue set to simplify threshold management and somewhat reduce
coupling.
Testing:
mach5 tier1-3
Manual tests with refinement thread logging enabled to verify expected
activations occur.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7282/head:pull/7282
$ git checkout pull/7282
Update a local copy of the PR:
$ git checkout pull/7282
$ git pull https://git.openjdk.java.net/jdk pull/7282/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7282
View PR using the GUI difftool:
$ git pr show -t 7282
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7282.diff