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

8261495: Shenandoah: reconsider update references memory ordering #2498

Conversation

shipilev
Copy link
Contributor

@shipilev shipilev commented Feb 10, 2021

Shenandoah update heap references code uses default Atomic::cmpxchg to avoid races with mutator updates. Hotspot's default for atomic operations is memory_order_conservative, which emits two-way memory fences around the CASes at least on AArch64 and PPC64.

This seems to be excessive for Shenandoah update references code, and "release" is enough. We do not seem to piggyback on update-references memory effects anywhere (in fact, if not for mutator, we would not even need a CAS). But, there is an interplay with concurrent evacuation and updates from self-healing.

Average time goes down, the number of GC cycles go up, since the cycles are shorter. For example, SPECjvm2008:compiler.sunflow:

# Before
[172.931s][info][gc,stats] Concurrent Update Refs         =    9.866 s (a =    60161 us)
[283.225s][info][gc,stats] Concurrent Update Refs         =    8.274 s (a =    57859 us)
[232.514s][info][gc,stats] Concurrent Update Refs         =    9.321 s (a =    58991 us)
[215.495s][info][gc,stats] Concurrent Update Refs         =    9.233 s (a =    58434 us)
[217.557s][info][gc,stats] Concurrent Update Refs         =    9.153 s (a =    58672 us)

# After
[169.752s][info][gc,stats] Concurrent Update Refs         =    8.150 s (a =    49697 us)
[168.798s][info][gc,stats] Concurrent Update Refs         =    8.430 s (a =    51092 us)
[166.353s][info][gc,stats] Concurrent Update Refs         =    8.812 s (a =    54395 us)
[236.542s][info][gc,stats] Concurrent Update Refs         =    8.215 s (a =    51026 us)
[214.006s][info][gc,stats] Concurrent Update Refs         =    8.244 s (a =    52175 us)

Additional testing:

  • Linux x86_64 hotspot_gc_shenandoah
  • Linux AArch64 hotspot_gc_shenandoah
  • Linux AArch64 tier1 with Shenandoah

Progress

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

Issue

  • JDK-8261495: Shenandoah: reconsider update references memory ordering

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2498

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

Using diff file

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Feb 10, 2021

👋 Welcome back shade! 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
Copy link

@openjdk openjdk bot commented Feb 10, 2021

@shipilev 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 Feb 10, 2021
@shipilev shipilev marked this pull request as ready for review Feb 10, 2021
@openjdk openjdk bot added the rfr label Feb 10, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Feb 10, 2021

Webrevs

Copy link
Contributor

@zhengyu123 zhengyu123 left a comment

Looks good to me.

@openjdk
Copy link

@openjdk openjdk bot commented Feb 11, 2021

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

8261495: Shenandoah: reconsider update references memory ordering

Reviewed-by: zgu, 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 19 new commits pushed to the master branch:

  • ee0247f: 8263461: jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java uses wrong mechanism to cause evacuation failure
  • 3ad20fc: 8269571: NMT should print total malloc bytes and invocation count
  • b969136: 8245877: assert(_value != __null) failed: resolving NULL _value in JvmtiExport::post_compiled_method_load
  • ee526a2: Merge
  • 0d745ae: 8269034: AccessControlException for SunPKCS11 daemon threads
  • d042029: 8269529: javax/swing/reliability/HangDuringStaticInitialization.java fails in Windows debug build
  • 401cb0a: 8269232: assert(!is_jweak(handle)) failed: wrong method for detroying jweak
  • b8a16e9: 8268884: C2: Compile::remove_speculative_types must iterate top-down
  • 25f9f19: 8249646: Runtime.exec(String, String[], File) documentation contains literal {@link ...}
  • 0d83dc2: 8268699: Shenandoah: Add test for JDK-8268127
  • ... and 9 more: https://git.openjdk.java.net/jdk/compare/a97715755d01b88ad9e4cf32f10ca5a3f2fda898...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 Feb 11, 2021
Copy link
Contributor

@rkennke rkennke left a comment

Looks good to me.

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 21, 2021

@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@shipilev
Copy link
Contributor Author

@shipilev shipilev commented Apr 21, 2021

Not yet, bot. Waiting for JDK-8261579 to remeasure perf differences.

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented May 19, 2021

@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@shipilev
Copy link
Contributor Author

@shipilev shipilev commented May 19, 2021

Not yet, bot. Still waiting.

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jun 16, 2021

@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@shipilev
Copy link
Contributor Author

@shipilev shipilev commented Jun 22, 2021

Not now, bot. Still waiting.

@shipilev shipilev force-pushed the JDK-8261495-shenandoah-updaterefs-memord branch from 0d29996 to a033e37 Compare Jun 23, 2021
@shipilev shipilev force-pushed the JDK-8261495-shenandoah-updaterefs-memord branch from a033e37 to 71f419f Compare Jun 23, 2021
@shipilev
Copy link
Contributor Author

@shipilev shipilev commented Jun 29, 2021

@rkennke, @zhengyu123 -- please take a look again. Now that JDK-8261579 is there, the performance data is available (PR body), and it seems to be ready to go.

@zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Jun 29, 2021

Still good to me. Thanks.

@shipilev
Copy link
Contributor Author

@shipilev shipilev commented Jun 30, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Jun 30, 2021

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

  • 23d2996: 8269478: Shenandoah: gc/shenandoah/mxbeans tests should be more resilient
  • a6b253d: 8269416: [JVMCI] capture libjvmci crash data to a file
  • a0f32cb: 8268906: gc/g1/mixedgc/TestOldGenCollectionUsage.java assumes that GCs take 1ms minimum
  • ee0247f: 8263461: jdk/jfr/event/gc/detailed/TestEvacuationFailedEvent.java uses wrong mechanism to cause evacuation failure
  • 3ad20fc: 8269571: NMT should print total malloc bytes and invocation count
  • b969136: 8245877: assert(_value != __null) failed: resolving NULL _value in JvmtiExport::post_compiled_method_load
  • ee526a2: Merge
  • 0d745ae: 8269034: AccessControlException for SunPKCS11 daemon threads
  • d042029: 8269529: javax/swing/reliability/HangDuringStaticInitialization.java fails in Windows debug build
  • 401cb0a: 8269232: assert(!is_jweak(handle)) failed: wrong method for detroying jweak
  • ... and 12 more: https://git.openjdk.java.net/jdk/compare/a97715755d01b88ad9e4cf32f10ca5a3f2fda898...master

Your commit was automatically rebased without conflicts.

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

@openjdk openjdk bot commented Jun 30, 2021

@shipilev Pushed as commit a96012a.

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

@shipilev shipilev deleted the JDK-8261495-shenandoah-updaterefs-memord branch Jul 2, 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