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

8301116: Parallelize TLAB resizing in G1 #12360

Closed

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Feb 1, 2023

Hi all,

can I get reviews for this change that moves TLAB resizing into the second parallel post evacuation phase?

The change is fairly straightforward except maybe for the following:

  • there is a new claimer for JavaThreads because the Threads::possibly_parallel_threads_do method to parallelize does not work well with very little per-thread work. Actually with a moderate amount of threads (~20) performance would already be many times slower than doing things serially.
  • moving the TLAB resizing out of G1CollectedHeap::prepare_tlabs_for_mutator made that method and the enclosing timing a bit obsolete, so I repurposed it as a "do preparatory work for the mutator during young gc" phase. That resulted in minor cleanup and regularization of what is done during that phase (wrt to what the corresponding method for full gc does).

Testing: gha, local perf testing, tier1

Thanks,
Thomas


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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12360

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

Using diff file

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

Fix Thread::possibly_parallel_threads_do

refactoring

Initial version, remove retire tlab stuff
@bridgekeeper
Copy link

bridgekeeper bot commented Feb 1, 2023

👋 Welcome back tschatzl! 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 changed the title 8301116 8301116: Parallelize TLAB resizing in G1 Feb 1, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 1, 2023
@openjdk
Copy link

openjdk bot commented Feb 1, 2023

@tschatzl 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 Feb 1, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 1, 2023

Webrevs

@tschatzl
Copy link
Contributor Author

tschatzl commented Feb 1, 2023

/label add hotspot-gc

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Feb 1, 2023
@openjdk
Copy link

openjdk bot commented Feb 1, 2023

@tschatzl
The hotspot-gc label was successfully added.

@tschatzl
Copy link
Contributor Author

tschatzl commented Feb 1, 2023

The reason for this change (and the follow-up(s)) is that in applications with a large number of Java threads (20k+), TLAB retirement, log buffer flushing and TLAB resizing takes 3-7% of total pause time.
Parallelization can reduce this time significantly.

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

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

Two minor suggestions:

  1. I think "inlining" the logic of G1JavaThreadsListClaimer makes the flow in the caller more transparent.

  2. ResizeThreadLABs -> ResizeTLABs, just to be consistent with other *TLAB occurrences.

@openjdk
Copy link

openjdk bot commented Feb 6, 2023

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

8301116: Parallelize TLAB resizing in G1

Reviewed-by: ayang, iwalulya

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 136 new commits pushed to the master branch:

  • c72f951: 8301853: C4819 warnings were reported in HotSpot on Windows
  • 36478ee: 8288783: Error messages are confusing when options conflict in -XX:StartFlightRecording
  • 70f3150: 8301443: Clean broken comments from Windows code
  • 5561c39: 8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled
  • c8cc7b6: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • dc6d52c: 8301876: Crash in DumpTimeClassInfo::add_verification_constraint
  • 873558e: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383: 8301717: Remove obsolete jib profiles
  • 631a279: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612: 8298478: (fs) Path.of should allow input to include long path prefix
  • ... and 126 more: https://git.openjdk.org/jdk/compare/90ec19efeda90f13a918b4481fe6ee552ab2af66...master

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 Feb 6, 2023
@tschatzl
Copy link
Contributor Author

tschatzl commented Feb 6, 2023

Two minor suggestions:

1. I think "inlining" the logic of `G1JavaThreadsListClaimer` makes the flow in the caller more transparent.

The G1JavaThreadsListClaimer will be used in the next PR about parallelizing TLAB retiring; however we came up with a nicer version of the claimer that hides the claiming implementation detail.

2. `ResizeThreadLABs` -> `ResizeTLABs`, just to be consistent with other *TLAB occurrences.

Unfortunately there is already the global option ResizeTLAB, and I did not want to have two (fairly global) constants to have almost the same name.

@openjdk openjdk bot mentioned this pull request Feb 6, 2023
3 tasks
Copy link
Member

@walulyai walulyai left a comment

Choose a reason for hiding this comment

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

Lgtm!

@tschatzl
Copy link
Contributor Author

tschatzl commented Feb 9, 2023

I'm pushing this because I consider @dholmes-ora and @kimbarrett 's question resolved - the code in question has been reverted after all.

Thanks everyone for your reviews.

/integrate

@openjdk
Copy link

openjdk bot commented Feb 9, 2023

Going to push as commit 83e2db6.
Since your change was applied there have been 136 commits pushed to the master branch:

  • c72f951: 8301853: C4819 warnings were reported in HotSpot on Windows
  • 36478ee: 8288783: Error messages are confusing when options conflict in -XX:StartFlightRecording
  • 70f3150: 8301443: Clean broken comments from Windows code
  • 5561c39: 8294484: MetalBorder's FrameBorder & DialogBorder have border rendering issues when scaled
  • c8cc7b6: 8301704: Shorten the number of GCs in UnloadingTest.java to verify a class loader not being unloaded
  • dc6d52c: 8301876: Crash in DumpTimeClassInfo::add_verification_constraint
  • 873558e: 8300914: Allow @ as an escape in documentation comments
  • 8a9e383: 8301717: Remove obsolete jib profiles
  • 631a279: 8301567: The test/jdk/java/awt/AppContext/ApplicationThreadsStop/java.policy is unused
  • 638d612: 8298478: (fs) Path.of should allow input to include long path prefix
  • ... and 126 more: https://git.openjdk.org/jdk/compare/90ec19efeda90f13a918b4481fe6ee552ab2af66...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 9, 2023
@openjdk openjdk bot closed this Feb 9, 2023
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 9, 2023
@openjdk openjdk bot removed the rfr Pull request is ready for review label Feb 9, 2023
@openjdk
Copy link

openjdk bot commented Feb 9, 2023

@tschatzl Pushed as commit 83e2db6.

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

@tschatzl tschatzl deleted the submit/8301116-parallel-tlab-resize branch February 9, 2023 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated
5 participants