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

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

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 label Jul 13, 2021
@bridgekeeper
Copy link

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

Loading

@openjdk
Copy link

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

Loading

@openjdk openjdk bot added the hotspot-gc label Jul 13, 2021
@weixlu
Copy link
Contributor Author

@weixlu weixlu commented Jul 13, 2021

/covered

Loading

@weixlu
Copy link
Contributor Author

@weixlu weixlu commented Jul 13, 2021

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

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Jul 13, 2021

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

Loading

@bridgekeeper
Copy link

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

Loading

@tanghaoth90
Copy link
Contributor

@tanghaoth90 tanghaoth90 commented Jul 13, 2021

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

Loading

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jul 15, 2021

Webrevs

Loading

fisk
fisk approved these changes Jul 16, 2021
Copy link
Contributor

@fisk fisk left a comment

Looks good.

Loading

@openjdk
Copy link

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

Loading

@openjdk
Copy link

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

Loading

@openjdk openjdk bot added the ready label Jul 16, 2021
@tanghaoth90
Copy link
Contributor

@tanghaoth90 tanghaoth90 commented Jul 19, 2021

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

Loading

@stooart-mon
Copy link
Contributor

@stooart-mon stooart-mon commented Jul 19, 2021

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.

Loading

Copy link
Contributor

@stooart-mon stooart-mon left a comment

Looks good to me.

Loading

@tanghaoth90
Copy link
Contributor

@tanghaoth90 tanghaoth90 commented Jul 20, 2021

Looks good to me.

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

Loading

@stooart-mon
Copy link
Contributor

@stooart-mon stooart-mon commented Jul 20, 2021

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

Loading

pliden
pliden approved these changes Aug 3, 2021
Copy link
Contributor

@pliden pliden left a comment

Looks good!

Loading

@pliden
Copy link
Contributor

@pliden pliden commented Aug 3, 2021

I'll sponsor the change.

Loading

@weixlu
Copy link
Contributor Author

@weixlu weixlu commented Aug 3, 2021

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

Loading

@weixlu
Copy link
Contributor Author

@weixlu weixlu commented Aug 3, 2021

/integrate

Loading

@openjdk openjdk bot added the sponsor label Aug 3, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Aug 3, 2021

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

Loading

@pliden
Copy link
Contributor

@pliden pliden commented Aug 3, 2021

/sponsor

Loading

@openjdk
Copy link

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

Loading

@openjdk openjdk bot closed this Aug 3, 2021
@openjdk
Copy link

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

Loading

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