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

8273559: Shenandoah: Shenandoah should support multi-threaded heap dump #5473

Closed
wants to merge 3 commits into from

Conversation

@zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Sep 10, 2021

At the point when Shenandoah implemented heap dump, there was no ClassLoaderData::_claim_other flag. To avoid CLDG iteration interfering concurrent GC, we chosen single-threaded CLDG iteration with ClassLoaderData::_claim_none and ensured that by asserting calling thread has to be VMThread.

JDK-8237354 broke the assumption, as it uses safepoint worker to execute heap dump, so that the thread executes CLDG iteration is not necessary VMThread.

Now, with new ClassLoaderData::_claim_other, we can enable multi-threaded CLDG iteration during heap dump.

Test:

  • hotspot_gc_shenandoah
  • tier1 with Shenandoah GC

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8273559: Shenandoah: Shenandoah should support multi-threaded heap dump

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5473/head:pull/5473
$ git checkout pull/5473

Update a local copy of the PR:
$ git checkout pull/5473
$ git pull https://git.openjdk.java.net/jdk pull/5473/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5473

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5473.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 10, 2021

👋 Welcome back zgu! 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.

Loading

@openjdk openjdk bot added the rfr label Sep 10, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 10, 2021

@zhengyu123 The following labels will be automatically applied to this pull request:

  • hotspot-gc
  • shenandoah

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.

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 10, 2021

Webrevs

Loading

Copy link
Contributor

@shipilev shipilev left a comment

Looks fine to me with minor nits.

Loading

throw new RuntimeException("Dump file not created");
}
}
}
Copy link
Contributor

@shipilev shipilev Sep 13, 2021

Choose a reason for hiding this comment

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

Newline is missing.

Loading

Copy link
Contributor Author

@zhengyu123 zhengyu123 Sep 13, 2021

Choose a reason for hiding this comment

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

Fixed

Loading

// Limit concurrency a bit, otherwise it wastes resources when workers are tripping
// over each other. This also leaves free workers to process other parts of the root
// set, while admitted workers are busy with doing the CLDG walk.
return MAX2(1u, MIN2(ShenandoahSharedSemaphore::max_tokens(), n_workers / 2));
}

public:
ShenandoahClassLoaderDataRoots(ShenandoahPhaseTimings::Phase phase, uint n_workers);
ShenandoahClassLoaderDataRoots(ShenandoahPhaseTimings::Phase phase, uint n_workers, bool heapdump);
Copy link
Contributor

@shipilev shipilev Sep 13, 2021

Choose a reason for hiding this comment

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

Can we call the new parameter heap_iteration? This would match the ShenandoahHeapIterationRootScanner name. I could also imagine that iteration is used for something else than a heap dump (maybe JFR/JVMTI heap walk for profiling/debugging?).

Loading

Copy link
Contributor Author

@zhengyu123 zhengyu123 Sep 13, 2021

Choose a reason for hiding this comment

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

Fixed. Thanks!

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 13, 2021

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

8273559: Shenandoah: Shenandoah should support multi-threaded heap dump

Reviewed-by: shade, rkennke, sgehwolf

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

  • 4c673df: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage
  • 8fbcc82: 8273494: Zero: Put libjvm.so into "zero" folder, not "server"
  • 92c30c9: 8273599: Remove cross_threshold method usage around GC
  • 02af541: 8273605: VM Exit does not abort concurrent mark
  • febcc72: 8273366: [testbug] javax/swing/UIDefaults/6302464/bug6302464.java fails on macOS12
  • 1017a2c: 8273135: java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java crashes in liblcms.dylib with NULLSeek+0x7
  • 6cf70f5: 8273638: javax/swing/JTable/4235420/bug4235420.java fails in GTK L&F
  • e66bf47: 8273414: ResourceObj::operator delete should handle nullptr in debug builds
  • 16c3ad1: 8272574: C2: assert(false) failed: Bad graph detected in build_loop_late
  • e7ab372: 8273641: (bf) Buffer subclasses documentation contains template strings
  • ... and 23 more: https://git.openjdk.java.net/jdk/compare/f9b2507f3e86bcb91e8ccfd0a84f31712fd535c2...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.

Loading

@openjdk openjdk bot added the ready label Sep 13, 2021
// Must use _claim_none to avoid interfering with concurrent CLDG iteration
CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
CLDToOopClosure clds(oops, ClassLoaderData::_claim_other);
Copy link
Contributor

@jerboaa jerboaa Sep 13, 2021

Choose a reason for hiding this comment

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

Nit: Update/remove comment? Must use _claim_none ... seems to conflict with code.

Loading

Copy link
Contributor Author

@zhengyu123 zhengyu123 Sep 13, 2021

Choose a reason for hiding this comment

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

Fixed. Thanks!

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 13, 2021

@zhengyu123 this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8273559-heap-dump
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

Loading

@openjdk openjdk bot added merge-conflict and removed ready labels Sep 13, 2021
@openjdk openjdk bot added ready and removed merge-conflict labels Sep 13, 2021
Copy link
Contributor

@jerboaa jerboaa left a comment

comment change looks good :)

Loading

@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Sep 15, 2021

Loading

@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Sep 15, 2021

/integrate

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 15, 2021

Going to push as commit 8132bfd.
Since your change was applied there have been 34 commits pushed to the master branch:

  • f531b5c: 8273514: java/util/DoubleStreamSums/CompensatedSums.java failure
  • 4c673df: 8273656: Improve java.lang.invoke.MethodType.parameterList() and its usage
  • 8fbcc82: 8273494: Zero: Put libjvm.so into "zero" folder, not "server"
  • 92c30c9: 8273599: Remove cross_threshold method usage around GC
  • 02af541: 8273605: VM Exit does not abort concurrent mark
  • febcc72: 8273366: [testbug] javax/swing/UIDefaults/6302464/bug6302464.java fails on macOS12
  • 1017a2c: 8273135: java/awt/color/ICC_ColorSpace/MTTransformReplacedProfile.java crashes in liblcms.dylib with NULLSeek+0x7
  • 6cf70f5: 8273638: javax/swing/JTable/4235420/bug4235420.java fails in GTK L&F
  • e66bf47: 8273414: ResourceObj::operator delete should handle nullptr in debug builds
  • 16c3ad1: 8272574: C2: assert(false) failed: Bad graph detected in build_loop_late
  • ... and 24 more: https://git.openjdk.java.net/jdk/compare/f9b2507f3e86bcb91e8ccfd0a84f31712fd535c2...master

Your commit was automatically rebased without conflicts.

Loading

@openjdk openjdk bot closed this Sep 15, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 15, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Sep 15, 2021

@zhengyu123 Pushed as commit 8132bfd.

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

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants