Skip to content

8270347: ZGC: Adopt release-acquire ordering for forwarding table access #4763

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

Closed
wants to merge 1 commit into from

Conversation

weixlu
Copy link
Contributor

@weixlu weixlu commented Jul 13, 2021

ZGC forwarding table records entries to track the destination of object relocation. Currently, the entry insertion (ZForwarding::insert()) adopts memory_order_conservative to guarantee that (1) the object copy always happens before the installation of forwardee, and (2) the other thread that accesses the same entry (ZForwarding::at() with load_acquire semantic) is able to access the correct contents of the forwarded object.

Let us consider memory_order_release for the entry insertion in ZForwarding::insert(). Pairing with the entry access in ZForwarding::at(), the forwarding table adopts release-acquire memory ordering. The two statements we mentioned above can also be guaranteed by the release-acquire ordering.

We performed an experiment on benchmark SPECjvm2008.sunflow on AArch64. The concurrent relocation time is listed below. The optimized version results in shorter average concurrent relocation time. Furthermore, it could benefit the throughput of ZGC.

$ grep "[50]00.*Phase: Concurrent Relocate" optimized.log
[500.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.006 / 4.449         4.041 / 5.361         4.041 / 5.361         4.041 / 5.361       ms
[1000.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.512 / 5.278         4.213 / 5.278         4.146 / 5.361         4.146 / 5.361       ms
[1500.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.831 / 5.524         4.446 / 5.584         4.253 / 5.584         4.253 / 5.584       ms
[2000.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.037 / 4.649         4.391 / 5.524         4.281 / 5.584         4.281 / 5.584       ms
[2500.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.256 / 4.568         4.198 / 5.022         4.265 / 5.584         4.265 / 5.584       ms
[3000.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           3.032 / 4.424         3.810 / 24.709        4.173 / 24.709        4.173 / 24.709      ms
[3500.506s][info][gc,stats    ]       Phase: Concurrent Relocate                           3.740 / 4.598         3.304 / 4.872         4.050 / 24.709        4.050 / 24.709      ms

$ grep "[50]00.*Phase: Concurrent Relocate" baseline.log
[500.545s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.634 / 5.191         4.425 / 5.490         4.425 / 5.490         4.425 / 5.490       ms
[1000.545s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.177 / 4.731         4.414 / 5.543         4.400 / 5.543         4.400 / 5.543       ms
[1500.545s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.560 / 4.894         4.441 / 5.543         4.427 / 5.543         4.427 / 5.543       ms
[2000.546s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.509 / 5.100         4.591 / 5.739         4.468 / 5.739         4.468 / 5.739       ms
[2500.545s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.543 / 5.533         4.685 / 5.762         4.511 / 5.762         4.511 / 5.762       ms
[3000.546s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.423 / 4.834         4.635 / 5.895         4.530 / 5.895         4.530 / 5.895       ms
[3500.545s][info][gc,stats    ]       Phase: Concurrent Relocate                           4.152 / 5.243         4.313 / 24.341        4.493 / 24.341        4.493 / 24.341      ms

Progress

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

Issue

  • JDK-8270347: ZGC: Adopt release-acquire ordering for forwarding table access

Reviewers

Contributors

  • Hao Tang <albert.th@alibaba-inc.com>

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4763

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

Using diff file

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

@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label Jul 13, 2021
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 13, 2021

Hi @weixlu, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user weixlu" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented Jul 13, 2021

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

  • hotspot-gc

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-gc hotspot-gc-dev@openjdk.org label Jul 13, 2021
@weixlu
Copy link
Contributor Author

weixlu commented Jul 13, 2021

/covered

@weixlu
Copy link
Contributor Author

weixlu commented Jul 13, 2021

/contributor add Hao Tang albert.th@alibaba-inc.com

@openjdk
Copy link

openjdk bot commented Jul 13, 2021

@weixlu
Contributor Hao Tang <albert.th@alibaba-inc.com> successfully added.

@bridgekeeper bridgekeeper bot added the oca-verify Needs verification of OCA signatory status label Jul 13, 2021
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 13, 2021

Thank you! Please allow for a few business days to verify that your employer has signed the OCA. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated!

@tanghaoth90
Copy link
Contributor

#4597 implements memory_order_release for AArch64. We think this could benefit ZGC as well.

@bridgekeeper bridgekeeper bot removed oca Needs verification of OCA signatory status oca-verify Needs verification of OCA signatory status labels Jul 15, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 15, 2021
@mlbridge
Copy link

mlbridge bot commented Jul 15, 2021

Webrevs

Copy link
Contributor

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

@openjdk
Copy link

openjdk bot commented Jul 16, 2021

⚠️ @weixlu the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout cas
$ git commit -c user.name='Preferred Full Name' --allow-empty -m 'Update full name'
$ git push

@openjdk
Copy link

openjdk bot commented Jul 16, 2021

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

8270347: ZGC: Adopt release-acquire ordering for forwarding table access

Co-authored-by: Hao Tang <albert.th@alibaba-inc.com>
Reviewed-by: eosterlund, pliden

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

  • c8add22: Merge
  • ada58d1: 8067223: [TESTBUG] Rename Whitebox API package
  • f8fb571: 8271150: Remove EA from JDK 17 version string starting with Initial RC promotion on Aug 5, 2021(B34)
  • 84f0231: 8271419: Refactor test code for modifying CDS archive contents
  • 0b95394: 8271624: Avoid unnecessary ThreadGroup.checkAccess calls when creating Threads
  • e621cff: 8271627: Use local field access in favor of Class.getClassLoader0
  • 0a85236: 8193559: ugly DO_JAVA_THREADS macro should be replaced
  • db950ca: 8271348: Add stronger sanity check of thread state when polling for safepoint/handshakes
  • 3e3051e: 8251329: (zipfs) Files.walkFileTree walks infinitely if zip has dir named "." inside
  • 7a4c754: 8271611: Use SecurityConstants.ACCESS_PERMISSION in MethodHandles
  • ... and 242 more: https://git.openjdk.java.net/jdk/compare/07e90524576f159fc16523430f1db62327c89a3b...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@fisk, @pliden) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 16, 2021
@tanghaoth90
Copy link
Contributor

Hi, it seems that a non-trivial patch requires at least two reviewers. @pliden would you please review this patch?

@stooart-mon
Copy link
Contributor

I believe we're good because the release you've changed this to is matched by the ZForwarding::at() accesses the entries with an acquire, and I can find no other means of accessing entries.

Copy link
Contributor

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

@tanghaoth90
Copy link
Contributor

Looks good to me.

@stooart-mon Thanks for reviewing. Could you please approve this pull request?

@stooart-mon
Copy link
Contributor

I'm not a committer or reviewer, so I can't officially approve this.

Copy link
Contributor

@pliden pliden 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!

@pliden
Copy link
Contributor

pliden commented Aug 3, 2021

I'll sponsor the change.

@weixlu
Copy link
Contributor Author

weixlu commented Aug 3, 2021

@pliden @fisk @stooart-mon Thank you very much for your review.

@weixlu
Copy link
Contributor Author

weixlu commented Aug 3, 2021

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Aug 3, 2021
@openjdk
Copy link

openjdk bot commented Aug 3, 2021

@weixlu
Your change (at version 413560a) is now ready to be sponsored by a Committer.

@pliden
Copy link
Contributor

pliden commented Aug 3, 2021

/sponsor

@openjdk
Copy link

openjdk bot commented Aug 3, 2021

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

  • b217a6c: 8271609: Misleading message for AbortVMOnVMOperationTimeoutDelay
  • c8add22: Merge
  • ada58d1: 8067223: [TESTBUG] Rename Whitebox API package
  • f8fb571: 8271150: Remove EA from JDK 17 version string starting with Initial RC promotion on Aug 5, 2021(B34)
  • 84f0231: 8271419: Refactor test code for modifying CDS archive contents
  • 0b95394: 8271624: Avoid unnecessary ThreadGroup.checkAccess calls when creating Threads
  • e621cff: 8271627: Use local field access in favor of Class.getClassLoader0
  • 0a85236: 8193559: ugly DO_JAVA_THREADS macro should be replaced
  • db950ca: 8271348: Add stronger sanity check of thread state when polling for safepoint/handshakes
  • 3e3051e: 8251329: (zipfs) Files.walkFileTree walks infinitely if zip has dir named "." inside
  • ... and 243 more: https://git.openjdk.java.net/jdk/compare/07e90524576f159fc16523430f1db62327c89a3b...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Aug 3, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Aug 3, 2021
@openjdk
Copy link

openjdk bot commented Aug 3, 2021

@pliden @weixlu Pushed as commit bdb50ca.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants