Skip to content
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

8227060: Optimize safepoint cleanup subtask order #9515

Closed
wants to merge 3 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jul 15, 2022

Most of the analysis in the CR is for code that's removed, but I found one safepoint cleanup task that's unused. Also the dictionary resizing and symbol/string table rehashing, while rare, could take a long time so I moved them sooner in the list.
Tested with tier1-3.


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-8227060: Optimize safepoint cleanup subtask order

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9515

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 15, 2022

👋 Welcome back coleenp! 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 openjdk bot added the rfr Pull request is ready for review label Jul 15, 2022
@openjdk
Copy link

openjdk bot commented Jul 15, 2022

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

  • hotspot

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 hotspot hotspot-dev@openjdk.org label Jul 15, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 15, 2022

Webrevs

Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit of history here. It seems that some of the point of the original CR has
disappeared. There used to be a use of parallel_java_threads_do at the start
(from JDK-8180932), with the CR suggesting moving that to the end. That
disappeared with JDK-8246476. So some of the point of the CR has gone away.
But ordering the remaining tasks from expensive to cheap is still sensible,
and the new order mostly [*] looks plausible.

A different (pre-existing) problem is that the use of the workers isn't great.
The amount of parallelism is just the workgang's current active_workers(),
with no regard to how much parallelism we have. Presently the maximum useful
amount of parallelism is the number of subtasks, so 6 (which might easily and
likely be reduced with some pre-checks). So we're going to apply
active_workers threads (whatever that happens to be at the moment) to a task
which can use only a relatively small and fixed [*] number of threads.
Improving the use of the workgang should be a separate RFE.

[*] JDK-8253180 later (after JDK-8246476) introduced the serial threads_do to
set GC watermarks. Digging into it a bit, that doesn't look obviously
lightweight; I wonder if it should be (should have been) parallelized (and
placed at the end of the work). But that's a separate RFE.

};

class ParallelSPCleanupTask : public WorkerTask {
class ParallelCleanupTask : public WorkerTask {
private:
SubTasksDone _subtasks;
uint _num_workers;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[pre-existing] _num_workers seems to no longer be used.

@@ -547,33 +538,23 @@ class ParallelSPCleanupTask : public WorkerTask {
}
};

class SafepointCleanupThreadClosure : public ThreadClosure {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name doesn't seem to have much more to do with what it does than did the old name. The class definition could be moved to the single point of use and just called "Closure" to avoid needing to come up with a good name :)

@coleenp
Copy link
Contributor Author

coleenp commented Jul 16, 2022

@kimbarrett I made your suggested improvements, even though a class in the middle of function looks odd to me. Maybe someday it can be replaced with a lambda. Reran tier1 tests locally. I agree that the problem that this was supposed to solve may be gone now, but if we do resizing and rehashing, it would be good to have that in parallel with the other tasks. The threads are already created, otherwise the cost of creating them would not be worth making this parallel. I can't comment on how much work the lazy stack watermark processing is.

Copy link

@kimbarrett kimbarrett 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. There may be a couple of followup RFEs to be filed; we can discuss those later.

@openjdk
Copy link

openjdk bot commented Jul 17, 2022

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

8227060: Optimize safepoint cleanup subtask order

Reviewed-by: kbarrett, pchilanomate

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 44 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 openjdk bot added the ready Pull request is ready to be integrated label Jul 17, 2022
Copy link
Contributor

@pchilano pchilano 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 to me.

@coleenp
Copy link
Contributor Author

coleenp commented Jul 19, 2022

Thank you, Kim and Patricio!
/integrate

@openjdk
Copy link

openjdk bot commented Jul 19, 2022

Going to push as commit 96a542f.
Since your change was applied there have been 45 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 19, 2022
@openjdk openjdk bot closed this Jul 19, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 19, 2022
@openjdk
Copy link

openjdk bot commented Jul 19, 2022

@coleenp Pushed as commit 96a542f.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@coleenp coleenp deleted the safepoint branch July 19, 2022 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants