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

8279856: Parallel: Use PreservedMarks to record promotion-failed objects #7028

Closed

Conversation

albertnetymk
Copy link
Member

@albertnetymk albertnetymk commented Jan 11, 2022

Simple change of using PreservedMarks to skip young-gen walking in finding promotion-failed objs.

Test: tier1-6


Progress

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

Issue

  • JDK-8279856: Parallel: Use PreservedMarks to record promotion-failed objects

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 7028

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 11, 2022

👋 Welcome back ayang! 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 Jan 11, 2022
@openjdk
Copy link

openjdk bot commented Jan 11, 2022

@albertnetymk 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 Jan 11, 2022
@mlbridge
Copy link

mlbridge bot commented Jan 11, 2022

Webrevs

Copy link
Contributor

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

One think that would be interesting would be to do some measurements on the additional memory usage for the PreservedMarks stack with this change. To better understand what kind of memory trade-off we do for the quicker processing.

@@ -360,7 +360,7 @@ oop PSPromotionManager::oop_promotion_failed(oop obj, markWord obj_mark) {

push_contents(obj);

_preserved_marks->push_if_necessary(obj, obj_mark);
_preserved_marks->push_always(obj, obj_mark);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a comment here explaining that we use the preserved marks no only to preserved "special" marks but also to restore and clear the forwardning pointer in "normal" marks.

@@ -57,6 +57,7 @@ class PreservedMarks {
public:
size_t size() const { return _stack.size(); }
inline void push_if_necessary(oop obj, markWord m);
inline void push_always(oop obj, markWord m);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to just call this push() like we had in the past and maybe also re-use it in push_if_necessary()?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking push_always makes a clearer contrast with its neighbor: the two are parallel and there's no interconnection/dependency btw them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but they do push elements the same way so it could be shared to avoid having to change two places if anything needs updating in the future. That said, the code is small and live close together so should be fine if you prefer it this way.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's better not to mix the two APIs. The duplication is very small after all.

Comment on lines -706 to -708
RemoveForwardedPointerClosure remove_fwd_ptr_closure;
young_gen->object_iterate(&remove_fwd_ptr_closure);

Copy link
Contributor

Choose a reason for hiding this comment

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

Since these are removed, there is no longer any need to get heap and young_gen above either. I think the cleanest would be do directly use ParallelScavengeHeap::heap() in:

NOT_PRODUCT(heap->reset_promotion_should_fail();)

@tschatzl
Copy link
Contributor

One think that would be interesting would be to do some measurements on the additional memory usage for the PreservedMarks stack with this change. To better understand what kind of memory trade-off we do for the quicker processing.

It might actually be nice to have some log message for that memory usage somewhere; while I know there is no "framework" for that in Parallel/Serial, it would still be nice to have.

@openjdk
Copy link

openjdk bot commented Jan 31, 2022

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

8279856: Parallel: Use PreservedMarks to record promotion-failed objects

Reviewed-by: sjohanss, tschatzl

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

  • 993a248: 8280450: Add task queue printing to STW Full GCs
  • dcc666d: 8280139: Report more detailed statistics about task stealing in task queue stats
  • bdda43e: 8280705: Parallel: Full gc mark stack draining should prefer to make work available to other threads
  • 091aff9: 8278908: [macOS] Unexpected text normalization on pasting from clipboard
  • 61794c5: 8280817: Clean up and unify empty VM operations
  • c6ed204: 8278263: Remove redundant synchronized from URLStreamHandler.openConnection methods
  • 251351f: 8280889: java/lang/instrument/GetObjectSizeIntrinsicsTest.java fails with -XX:-UseCompressedOops
  • be9f984: 8280553: resourcehogs/serviceability/sa/TestHeapDumpForLargeArray.java can fail if GC occurs
  • 268880b: 8277412: Use String.isBlank to simplify code in sun.net.www.protocol.mailto.Handler
  • d366d15: 8280903: javadoc build fails after JDK-4774868
  • ... and 279 more: https://git.openjdk.java.net/jdk/compare/3121898c33fa3cc5a049977f8677105a84c3e50c...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 Jan 31, 2022
Copy link
Contributor

@tschatzl tschatzl left a comment

Choose a reason for hiding this comment

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

Lgtm.

@albertnetymk
Copy link
Member Author

Thanks for the review.

/integrate

@openjdk
Copy link

openjdk bot commented Feb 1, 2022

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

  • de3113b: 8279842: HTTPS Channel Binding support for Java GSS/Kerberos
  • 0e70d45: 8280950: RandomGenerator:NextDouble() default behavior non conformant after JDK-8280550 fix
  • 1ea0146: 8281007: Test jdk/javadoc/doclet/checkStylesheetClasses/CheckStylesheetClasses.java fails after JDK-8280738
  • 9c0104b: 8221642: AccessibleObject::setAccessible throws NPE when invoked by JNI code with no java frame on stack
  • 4dbebb6: 8280534: Enable compile-time doclint reference checking
  • 4191b2b: 8275337: C1: assert(false) failed: live_in set of first block must be empty
  • 96d0df7: 8272984: javadoc support for reproducible builds
  • ee3be0b: 8280488: doclint reference checks withstand warning suppression
  • 74921e8: 8280738: Minor cleanup for HtmlStyle
  • 3916561: 8280543: Update the "java" and "jcmd" tool specification for CDS
  • ... and 291 more: https://git.openjdk.java.net/jdk/compare/3121898c33fa3cc5a049977f8677105a84c3e50c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 1, 2022
@openjdk openjdk bot closed this Feb 1, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 1, 2022
@openjdk
Copy link

openjdk bot commented Feb 1, 2022

@albertnetymk Pushed as commit 16ec47d.

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

@albertnetymk albertnetymk deleted the parallel-promotion-failure branch February 1, 2022 08:47
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.

3 participants