Skip to content

8267188: gc/stringdedup/TestStringDeduplicationInterned.java fails with Shenandoah #5151

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

Conversation

zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Aug 17, 2021

Shenandoah currently enqueues deduplication candidates when marks object gray.

However, it can not do so when it scans roots, as it can potentially result lock rank inversion between stack watermark lock and dedup request buffer lock.

As the result, it can not enqueue as many as candidates as it should be able to, I believe JDK-8271834 is due to the same problem. I purpose we switch to enqueue candidates when we mark object black.

We are still not able to enqueue all candidates, only when they have displaced headers or have monitor inflating in progress. Upstream is working on removing displaced headers, we should revisit the logic afterward, or we can choose to deduplicate all string regardless their ages.

Test:

  • hotspot_gc_shenandoah
  • tier1 with -XX:+UseShenandoahGC and -XX:+UseStringDeduplication

Progress

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

Issue

  • JDK-8267188: gc/stringdedup/TestStringDeduplicationInterned.java fails with Shenandoah

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 5151

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 17, 2021

👋 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 Pull request is ready for review label Aug 17, 2021
@openjdk
Copy link

openjdk bot commented Aug 17, 2021

@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 hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Aug 17, 2021
@mlbridge
Copy link

mlbridge bot commented Aug 17, 2021

Webrevs

Copy link
Contributor

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

@openjdk
Copy link

openjdk bot commented Aug 19, 2021

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

8267188: gc/stringdedup/TestStringDeduplicationInterned.java fails with Shenandoah

Reviewed-by: rkennke, shade

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 Aug 19, 2021
Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

Looks fine, modulo a few suggestions.

break;
}
}
}

template <class T, bool CANCELLABLE>
void ShenandoahMark::mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *terminator) {
template <class T, bool CANCELLABLE,StringDedupMode STRING_DEDUP>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
template <class T, bool CANCELLABLE,StringDedupMode STRING_DEDUP>
template <class T, bool CANCELLABLE, StringDedupMode STRING_DEDUP>

@@ -54,6 +68,7 @@ void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveD

if (task->is_not_chunked()) {
if (obj->is_instance()) {
dedup_string<STRING_DEDUP>(obj, req);
Copy link
Member

Choose a reason for hiding this comment

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

I do wonder if it is faster to first let the closure process the outbound references, and then do dedup for the object? This way, parallel GC workers can do work while we are calling dedup_string here. This is one of the reasons why old code did dedup check after the queue push. In other words, move this call at the end of this block.

@openjdk
Copy link

openjdk bot commented Aug 25, 2021

@zhengyu123 this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8267188-string-intern
git fetch https://git.openjdk.java.net/jdk master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed ready Pull request is ready to be integrated labels Aug 25, 2021
@zhengyu123
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 25, 2021

@zhengyu123 This PR has not yet been marked as ready for integration.

@openjdk
Copy link

openjdk bot commented Aug 25, 2021

⚠️ @zhengyu123 This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed merge-conflict Pull request has merge conflict with target branch labels Aug 25, 2021
@zhengyu123
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Aug 25, 2021

Going to push as commit 7212561.

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

openjdk bot commented Aug 25, 2021

@zhengyu123 Pushed as commit 7212561.

💡 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 shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants