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

8270894: Use acquire semantics in ObjectSynchronizer::read_stable_mark() #4829

Closed
wants to merge 1 commit into from

Conversation

rkennke
Copy link
Contributor

@rkennke rkennke commented Jul 19, 2021

Currently, the object header is read using plain loads in read_stable_mark() (synchronizer.cpp). The matching stores use release semantics in corresponding CAS and release_store(). It seems reasonable to use acquire-semantics for the loads of the object header.

See also discussion here:
https://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2021-July/050132.html

I propose to use MO_ACQUIRE when reading the object header in read_stable_mark() and some related loads of the header. As discussed in the thread, current_thread_holds_lock() is the only place where we could do without acquire, but it doesn't seem worth to introduce extra complexity just to make this access relaxed, because it does not seem to be used in any place that looks very performance sensitive.

If it were me, I'd probably also change the other mark() calls to MO_ACQUIRE for consistency, but that might be overkill.

Testing:

  • tier1
  • tier2

Progress

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

Issue

  • JDK-8270894: Use acquire semantics in ObjectSynchronizer::read_stable_mark()

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 4829

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 19, 2021

👋 Welcome back rkennke! 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 Pull request is ready for review label Jul 19, 2021
@openjdk
Copy link

openjdk bot commented Jul 19, 2021

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

  • hotspot

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

rkennke commented Jul 19, 2021

/cc hotspot-runtime

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Jul 19, 2021
@openjdk
Copy link

openjdk bot commented Jul 19, 2021

@rkennke
The hotspot-runtime label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Jul 19, 2021

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Hi Roman,

Arguably there could be some redundant barriers in there, but the logic in something like inflate is too complex to readily be analysed.

So LGTM.

Thanks,
David

@openjdk
Copy link

openjdk bot commented Jul 20, 2021

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

8270894: Use acquire semantics in ObjectSynchronizer::read_stable_mark()

Reviewed-by: dholmes

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

  • ea182b5: 8271060: Merge G1CollectedHeap::determine_start_concurrent_mark_gc and G1Policy::decide_on_conc_mark_initiation
  • fb85960: 8271149: remove unreferenced functions from EncodingSupport_md.c
  • 8156ff6: 8271147: java/nio/file/Path.java javadoc typo
  • 9935440: Merge
  • e3800e6: 8271162: runtime/StackTrace/LargeClassTest.java can be run in driver mode
  • ee93cef: 8271158: runtime/handshake/HandshakeTimeoutTest.java test doesn't check exit code
  • 84be910: 8271169: runtime/Safepoint/TestAbortVMOnSafepointTimeout.java can be run in driver mode
  • 2d165a2: 8271160: runtime/jni/checked/TestCheckedJniExceptionCheck.java doesn't set -Djava.library.path
  • 7165b3f: 8271155: Wrong path separator in env variable
  • ecc37b0: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1
  • ... and 63 more: https://git.openjdk.java.net/jdk/compare/a8f15427156b8095ee815fbe6ed14c25c1d4b374...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 Pull request is ready to be integrated label Jul 20, 2021
@rkennke
Copy link
Contributor Author

rkennke commented Jul 23, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Jul 23, 2021

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

  • ea182b5: 8271060: Merge G1CollectedHeap::determine_start_concurrent_mark_gc and G1Policy::decide_on_conc_mark_initiation
  • fb85960: 8271149: remove unreferenced functions from EncodingSupport_md.c
  • 8156ff6: 8271147: java/nio/file/Path.java javadoc typo
  • 9935440: Merge
  • e3800e6: 8271162: runtime/StackTrace/LargeClassTest.java can be run in driver mode
  • ee93cef: 8271158: runtime/handshake/HandshakeTimeoutTest.java test doesn't check exit code
  • 84be910: 8271169: runtime/Safepoint/TestAbortVMOnSafepointTimeout.java can be run in driver mode
  • 2d165a2: 8271160: runtime/jni/checked/TestCheckedJniExceptionCheck.java doesn't set -Djava.library.path
  • 7165b3f: 8271155: Wrong path separator in env variable
  • ecc37b0: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1
  • ... and 63 more: https://git.openjdk.java.net/jdk/compare/a8f15427156b8095ee815fbe6ed14c25c1d4b374...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jul 23, 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 labels Jul 23, 2021
@openjdk
Copy link

openjdk bot commented Jul 23, 2021

@rkennke Pushed as commit f226190.

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

@dholmes-ora
Copy link
Member

@rkennke two reviews are required for hotspot changes!

@rkennke
Copy link
Contributor Author

rkennke commented Jul 23, 2021

@rkennke two reviews are required for hotspot changes!

Oh shit. I forgot, sorry! Do you want me to back it out?

@dholmes-ora
Copy link
Member

Perhaps solicit a second review from someone. Thanks.

Copy link
Contributor

@adinn adinn left a comment

Choose a reason for hiding this comment

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

This looks fine to me

Copy link
Contributor

@adinn adinn left a comment

Choose a reason for hiding this comment

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

Reviewed

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