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

8255070: Shenandoah: Use single thread for concurrent CLD liveness test #777

Closed

Conversation

zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Oct 20, 2020

Since the concurrent liveness test does not touch any oops, there is no point to use multi-thread for the task, they just duplicate the work.

Also, multi-thread version requires to acquire ClassLoaderGraph_lock early, which is deadlock prone.


Progress

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

Testing

Linux x64 Windows x64 macOS x64
Build ✔️ (5/5 passed) ✔️ (2/2 passed) ✔️ (2/2 passed)
Test (tier1) ✔️ (9/9 passed) ✔️ (9/9 passed) ✔️ (9/9 passed)

Issue

  • JDK-8255070: Shenandoah: Use single thread for concurrent CLD liveness test

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/777/head:pull/777
$ git checkout pull/777

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 20, 2020

👋 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.

@openjdk openjdk bot added the rfr label Oct 20, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 20, 2020

@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.

@openjdk openjdk bot added hotspot-gc shenandoah labels Oct 20, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Oct 20, 2020

Webrevs

@@ -1941,7 +1941,7 @@ class ShenandoahConcurrentWeakRootsEvacUpdateTask : public AbstractGangTask {
ShenandoahVMWeakRoots<true /*concurrent*/> _vm_roots;

// Roots related to concurrent class unloading
ShenandoahClassLoaderDataRoots<true /* concurrent */, false /* single thread*/>
ShenandoahClassLoaderDataRoots<true /* concurrent */, true /* single thread*/>

Choose a reason for hiding this comment

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

Should the first input be false?

Copy link
Contributor Author

@zhengyu123 zhengyu123 Oct 21, 2020

Choose a reason for hiding this comment

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

No. It runs concurrently, so will need to acquire ClassLoaderGraph_lock.

assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
assert(Thread::current()->is_VM_thread(), "Can only be done by VM thread");
ClassLoaderDataGraph::always_strong_cld_do(clds);
}
} else if (_semaphore.try_acquire()) {
Copy link
Contributor

@rkennke rkennke Oct 21, 2020

Choose a reason for hiding this comment

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

It looks to me that we do:
if (_semaphore.try_acquire()) {

in both branches now. Can this be reshaped to do try_acquire() and claim_all() outermost?

assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
assert(Thread::current()->is_VM_thread(), "Can only be done by VM thread");
ClassLoaderDataGraph::cld_do(clds);
}
} else if (_semaphore.try_acquire()) {
Copy link
Contributor

@rkennke rkennke Oct 21, 2020

Choose a reason for hiding this comment

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

Same as above. Also, the only difference to above is cld_do() vs always_strong_cld_do(), with lots of identical boilerplate. Can this be refactored into a generic method that takes the final target method as argument?

Copy link
Contributor Author

@zhengyu123 zhengyu123 Oct 21, 2020

Choose a reason for hiding this comment

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

Refactored and retested. Thanks for the suggestion.

Copy link
Contributor

@rkennke rkennke left a comment

Also, I'd change the commit message to begin uppercase after Shenandoah: "Use..."

@zhengyu123 zhengyu123 changed the title 8255070: Shenandoah: use single thread for concurrent CLD liveness test 8255070: Shenandoah: Use single thread for concurrent CLD liveness test Oct 21, 2020
if (SINGLE_THREADED) ClassLoaderDataGraph_lock->lock();
f(clds);
if (SINGLE_THREADED) ClassLoaderDataGraph_lock->unlock();
_semaphore.claim_all();
Copy link
Contributor

@rkennke rkennke Oct 21, 2020

Choose a reason for hiding this comment

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

Would it be nicer to write this as follows?
if (SINGLE_THREADED) {
MutexLocker ml(ClassLoaderDataGraph_lock);
f(clds);
} else {
f(clds);
}

Copy link
Contributor

@rkennke rkennke left a comment

Looks good to me! Thank you!

@openjdk
Copy link

@openjdk openjdk bot commented Oct 21, 2020

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

8255070: Shenandoah: Use single thread for concurrent CLD liveness test

Reviewed-by: rkennke

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

  • 8d9e6d0: 8255041: Zero: remove old JSR 292 support leftovers
  • 0efdde1: 8238669: Long.divideUnsigned is extremely slow for certain values (Needs to be Intrinsic)
  • 365f19c: 8254790: SIGSEGV in string_indexof_char and stringL_indexof_char intrinsics
  • f813a28: 8254692: (se) Clarify the behaviour of the non-abstract SelectorProvider::inheritedChannel
  • c9269bf: 8255036: Shenandoah: Reset GC state for root verifier
  • 839f01d: 8242068: Signed JAR support for RSASSA-PSS and EdDSA
  • e559bd2: 8254889: name_and_sig_as_C_string usages in frame coding without ResourceMark
  • da97ab5: 8253474: Javadoc clean up in HttpsExchange, HttpsParameters, and HttpsServer
  • 7e26404: 8255000: C2: Unify IGVN processing when loop opts are over
  • 27230fa: 8255026: C2: Miscellaneous cleanups in Compile and PhaseIdealLoop code
  • ... and 76 more: https://git.openjdk.java.net/jdk/compare/4ffed326fa3969b8d984109d9fceb02c968f6b44...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 label Oct 21, 2020
@zhengyu123
Copy link
Contributor Author

@zhengyu123 zhengyu123 commented Oct 21, 2020

/integrate

@openjdk openjdk bot closed this Oct 21, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Oct 21, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Oct 21, 2020

@zhengyu123 Since your change was applied there have been 87 commits pushed to the master branch:

  • 6020991: 8255068: [JVMCI] errors during compiler creation can be hidden
  • 8d9e6d0: 8255041: Zero: remove old JSR 292 support leftovers
  • 0efdde1: 8238669: Long.divideUnsigned is extremely slow for certain values (Needs to be Intrinsic)
  • 365f19c: 8254790: SIGSEGV in string_indexof_char and stringL_indexof_char intrinsics
  • f813a28: 8254692: (se) Clarify the behaviour of the non-abstract SelectorProvider::inheritedChannel
  • c9269bf: 8255036: Shenandoah: Reset GC state for root verifier
  • 839f01d: 8242068: Signed JAR support for RSASSA-PSS and EdDSA
  • e559bd2: 8254889: name_and_sig_as_C_string usages in frame coding without ResourceMark
  • da97ab5: 8253474: Javadoc clean up in HttpsExchange, HttpsParameters, and HttpsServer
  • 7e26404: 8255000: C2: Unify IGVN processing when loop opts are over
  • ... and 77 more: https://git.openjdk.java.net/jdk/compare/4ffed326fa3969b8d984109d9fceb02c968f6b44...master

Your commit was automatically rebased without conflicts.

Pushed as commit 615b759.

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

@zhengyu123 zhengyu123 deleted the JDK-8255070-CLD-liveness branch Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc integrated shenandoah
3 participants