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

8329528: G1 does not update TAMS correctly when dropping retained regions during Concurrent Start pause #18692

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Apr 9, 2024

Hi all,

please review this change to fix the problem that when g1 ages out regions from the retained region collection set candidate list during a concurrent start gc, the TAMSes of these regions are not set correctly.

The change achieves this by changing the order of some calculations in G1YoungCollector::pre_evacuate_collection_set: instead of setting TAMSes before collection set calculation, do it later, adjusting the predicate determining whether to update the TAMSes at concurrent start pause start to exclude regions in the collection set.

Several attempts for different fixes were tried, one of them is still viewable by only considering the changesets before the "alternate implementation" commit. However they quickly grew to fairly large size and complicated the code a lot.

Testing: tier1-3, test case not failing any more

Thanks,
Thomas


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8329528: G1 does not update TAMS correctly when dropping retained regions during Concurrent Start pause (Bug - P1)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18692/head:pull/18692
$ git checkout pull/18692

Update a local copy of the PR:
$ git checkout pull/18692
$ git pull https://git.openjdk.org/jdk.git pull/18692/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 18692

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18692.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 9, 2024

👋 Welcome back tschatzl! 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
Copy link

openjdk bot commented Apr 9, 2024

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

8329528: G1 does not update TAMS correctly when dropping retained regions during Concurrent Start pause

Reviewed-by: ayang, iwalulya

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

  • 8817ba4: 8330000: ZGC: ZObjArrayAllocator may unnecessarily clear TypeArrays twice
  • f778642: 8330024: [AIX] replace my_disclaim64 helper by direct call to disclaim64
  • 7df4926: 8327741: JVM crash in hotspot/share/opto/compile.cpp - failed: missing inlining msg
  • 2ceeb6c: 8328822: C2: "negative trip count?" assert failure in profile predicate code
  • b04b304: 8329254: optimize integral reverse operations on x86 GFNI target.
  • d9c84e7: 8329656: assertion failed in MAP_ARCHIVE_MMAP_FAILURE path: Invalid immediate -5 0
  • 5e544f1: 8329491: GetThreadListStackTraces function should use JvmtiHandshake
  • 643dd48: 8329432: PopFrame and ForceEarlyReturn functions should use JvmtiHandshake
  • 70944ca: 8330033: com/sun/net/httpserver/bugs/B6431193.java fails in AssertionError after JDK-8326568
  • 279ed0d: 8329961: Buffer overflow in os::Linux::kernel_version
  • ... and 35 more: https://git.openjdk.org/jdk/compare/58e39c193211579316cfd09dc4117d510e317985...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 changed the title 8329528 8329528: G1: ElasticSearch crashes with references [in]to jdk.internal.vm.FillerArray Apr 9, 2024
@openjdk
Copy link

openjdk bot commented Apr 9, 2024

@tschatzl 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 Apr 9, 2024
@tschatzl tschatzl changed the title 8329528: G1: ElasticSearch crashes with references [in]to jdk.internal.vm.FillerArray 8329528: G1 does not update TAMS correctly when dropping retained regions during Concurrent Start pause Apr 10, 2024
@tschatzl tschatzl force-pushed the submit/8329528-fix-tams-for-aged-out-pinned-candidates branch from 72f183a to 9819639 Compare April 10, 2024 10:09
@tschatzl tschatzl marked this pull request as ready for review April 10, 2024 10:46
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 10, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 10, 2024

Webrevs

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

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

The fix looks good. However, in the long run, pulling out the logic around G1NumCollectionsKeepPinned from the cset construction seems cleaner. Also, NoteStartOfMarkHRClosure can keep the original simpler condition.

Copy link
Member

@walulyai walulyai left a comment

Choose a reason for hiding this comment

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

LGTM!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 10, 2024
@tschatzl
Copy link
Contributor Author

The fix looks good. However, in the long run, pulling out the logic around G1NumCollectionsKeepPinned from the cset construction seems cleaner.

That is true at first glance, but when trying that out for this change, to me the drawbacks outweighed the cleanliness argument that resulted in much more code:

  • extra loop over the collection set candidates, where that loop is at a different place in the code, called from pre_evacuate_collection_set. This creates an extra additional dependency when tracking dependencies there. One could imagine to add time tracking for this phase as well, resulting in more extra code.
  • logging of this filtering will become disjointed from collection set selection. Dropping a region from the collection set candidates implies not selecting it, and reflecting this properly in the selection process takes additional effort unless one agrees with having separate log messages. (E.g. it is a bit surprising that when you know that there were pinned regions, the cset selection may actually tell you that there were none).
  • this is very little extra code piggybacking it on the collection set selection

I think I considered this extra step for filtering when implementing this the first time, rejected it for all the extra effort (probably in the range of 100 LOC, see the diff for the 0c46d6a change - which is incomplete btw as it does not adjust the regression test and potentially add proper timing/logging) just to basically avoid this single if clause there.

Anyway, modifying this in this change at least it detracts from the problem at hand. I will file an RFE.

Also, NoteStartOfMarkHRClosure can keep the original simpler condition.

The additional clause is an arbitrary requirement/assumption by the existing code, asserting somewhere that cset regions do not have tams set initially.
All code paths for regions in the collection set update the TAMS, either clear again when freeing the region, or set it properly during evacuation failure, afair. I wanted to keep the initial assumption of cset regions having tams == bottom throughout.

Could you approve the change if it looks good to you?

Copy link
Member

@albertnetymk albertnetymk left a comment

Choose a reason for hiding this comment

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

The fix is small and easy to backport; can probably further improve the logic around pinning&cset at later PRs.

@tschatzl
Copy link
Contributor Author

Thanks @albertnetymk @walulyai for your reviews
/integrate

@openjdk
Copy link

openjdk bot commented Apr 11, 2024

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

  • 9acce7a: 8329774: Break long lines in jdk/src/jdk.hotspot.agent/doc /transported_core.html
  • f0cd866: 8329704: Implement framework for proper handling of JDK_LIBS
  • 8817ba4: 8330000: ZGC: ZObjArrayAllocator may unnecessarily clear TypeArrays twice
  • f778642: 8330024: [AIX] replace my_disclaim64 helper by direct call to disclaim64
  • 7df4926: 8327741: JVM crash in hotspot/share/opto/compile.cpp - failed: missing inlining msg
  • 2ceeb6c: 8328822: C2: "negative trip count?" assert failure in profile predicate code
  • b04b304: 8329254: optimize integral reverse operations on x86 GFNI target.
  • d9c84e7: 8329656: assertion failed in MAP_ARCHIVE_MMAP_FAILURE path: Invalid immediate -5 0
  • 5e544f1: 8329491: GetThreadListStackTraces function should use JvmtiHandshake
  • 643dd48: 8329432: PopFrame and ForceEarlyReturn functions should use JvmtiHandshake
  • ... and 37 more: https://git.openjdk.org/jdk/compare/58e39c193211579316cfd09dc4117d510e317985...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 11, 2024

@tschatzl Pushed as commit ff5c9a4.

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

@tschatzl tschatzl deleted the submit/8329528-fix-tams-for-aged-out-pinned-candidates branch June 11, 2024 09:44
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