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

8255131: G1CollectedHeap::is_in() returns wrong result #799

Closed

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Oct 22, 2020

Hi all,

please review this change to exchange the broken G1CollectedHeap::is_in() by G1CollectedHeap::is_in_exact() that has the same performance profile and correct.

G1CollectedHeap::is_in() returns true for any region ever committed (and crashes for not yet committed regions), while is_in_exact() (almost) did the right thing. Almost because HeapRegionManager::is_available() would assert if the given pointer is outside the heap and it's not guarded by is_in_reserved.

Test: tier1

Thanks,
Thomas


Progress

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

Issue

  • JDK-8255131: G1CollectedHeap::is_in() returns wrong result

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/799/head:pull/799
$ git checkout pull/799

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 22, 2020

👋 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 Oct 22, 2020

@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 Oct 22, 2020
@tschatzl tschatzl marked this pull request as ready for review October 22, 2020 09:12
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 22, 2020
@mlbridge
Copy link

mlbridge bot commented Oct 22, 2020

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!

@openjdk
Copy link

openjdk bot commented Oct 22, 2020

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

8255131: G1CollectedHeap::is_in() returns wrong result

Reviewed-by: sjohanss, kbarrett, ayang

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

  • 107fb9c: 8255049: Remove support for the hsdis decode_instructions entry point in hotspot
  • c1524c5: 8255208: CodeStrings passed to Disassembler::decode are ignored
  • 8e5dff0: 8255213: Shenandoah build fails without JFR after JDK-8255036
  • fe74f3c: 8255224: x86_32 tests fail with "bad AD file" after JDK-8223051
  • 64dc4b1: 8255225: compiler/aot tests fail on Windows with NPE during artifact resolution
  • a824781: 8255210: [Vector API] jdk/incubator/vector/Int256VectorTests.java crashes on AVX512 machines
  • 2ca7a08: 8255268: 32-bit failures in runtime/Metaspace/elastic
  • d8d9197: 8242559: Clean the "libawt_xawt" library from code for headless mode
  • ff5f226: 8255086: Update the root locale display names
  • 8afdcae: 8255031: Update java/util/prefs/AddNodeChangeListener.java to report more failure info
  • ... and 79 more: https://git.openjdk.java.net/jdk/compare/21e67e54604e60f57106be32d48ba75ebf8c1130...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 Oct 22, 2020
bool available = _hrm->is_available(addr_to_region((HeapWord*)p));
if (contains && available) {
if (is_in_reserved(p) &&
_hrm->is_available(addr_to_region((HeapWord*)p))) {

Choose a reason for hiding this comment

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

This line is misindented. But rather than adjusting the indentation, how about instead changing the function to

bool G1CollectedHeap::is_in(const void* p) const {
  return is_in_reserved(p) && _hrm->is_available(addr_to_region((HeapWord*)p));
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking something similar, so I would approve going with this proposal.

@tschatzl
Copy link
Contributor Author

Changed as requested.

Had a discussion with ayang about the specification of CollectedHeap::is_in(): it reads
// Returns "TRUE" iff "p" points into the committed areas of the heap. // This method can be expensive so avoid using it in performance critical // code.
but ZGC also checks if p is < top() within the region. This seems a good idea, but needs a change of that "specification" (and more testing although I think G1 fulfills that as well), so I'd like to postpone this change for now.

@tschatzl
Copy link
Contributor Author

Thanks @kimbarrett @albertnetymk @kstefanj for your reviews!

/integrate

@openjdk openjdk bot closed this Oct 23, 2020
@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 Oct 23, 2020
@openjdk
Copy link

openjdk bot commented Oct 23, 2020

@tschatzl Since your change was applied there have been 89 commits pushed to the master branch:

  • 107fb9c: 8255049: Remove support for the hsdis decode_instructions entry point in hotspot
  • c1524c5: 8255208: CodeStrings passed to Disassembler::decode are ignored
  • 8e5dff0: 8255213: Shenandoah build fails without JFR after JDK-8255036
  • fe74f3c: 8255224: x86_32 tests fail with "bad AD file" after JDK-8223051
  • 64dc4b1: 8255225: compiler/aot tests fail on Windows with NPE during artifact resolution
  • a824781: 8255210: [Vector API] jdk/incubator/vector/Int256VectorTests.java crashes on AVX512 machines
  • 2ca7a08: 8255268: 32-bit failures in runtime/Metaspace/elastic
  • d8d9197: 8242559: Clean the "libawt_xawt" library from code for headless mode
  • ff5f226: 8255086: Update the root locale display names
  • 8afdcae: 8255031: Update java/util/prefs/AddNodeChangeListener.java to report more failure info
  • ... and 79 more: https://git.openjdk.java.net/jdk/compare/21e67e54604e60f57106be32d48ba75ebf8c1130...master

Your commit was automatically rebased without conflicts.

Pushed as commit c520469.

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

@tschatzl tschatzl deleted the 8255131-g1collectedheap-is-in branch October 23, 2020 09: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
4 participants