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

8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure #10119

Closed
wants to merge 4 commits into from

Conversation

albertnetymk
Copy link
Member

@albertnetymk albertnetymk commented Sep 1, 2022

Simple change of removing unnecessary code.

Test: hotspot_gc


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-8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10119

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 1, 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 changed the title 8293210 8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure Sep 1, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 1, 2022
@openjdk
Copy link

openjdk bot commented Sep 1, 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 Sep 1, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 1, 2022

Webrevs

@openjdk
Copy link

openjdk bot commented Sep 5, 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:

8293210: G1: Remove redundant check in G1FreeHumongousRegionClosure

Reviewed-by: tschatzl, kbarrett

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

  • 8082c24: 8054572: [macosx] JComboBox paints the border incorrectly
  • b920d29: 8271328: User is able to choose the color after disabling the color chooser.
  • 5725a93: 8293879: Remove unnecessary castings in jdk.hotspot.agent
  • ab7f58a: 6286501: JTabbedPane throws NPE from its stateChanged listener in particular case
  • d41f69f: 8293849: PrintIdealPhase in compiler directives file is ignored when used with other compile commands
  • 471e2f1: 8292088: C2: assert(is_OuterStripMinedLoop()) failed: invalid node class: IfTrue

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 Sep 5, 2022
@@ -182,10 +182,6 @@ class G1FreeHumongousRegionClosure : public HeapRegionClosure {
}

virtual bool do_heap_region(HeapRegion* r) {
if (!r->is_starts_humongous()) {
return false;
}

Choose a reason for hiding this comment

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

I think this check is a fast-path to quickly filter out definitely uninteresting regions, which will be nearly all of them. I'm not convinced it should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's the same argument as JDK-8292858; the attr-table can (or should) be used instead of the region-type.

Choose a reason for hiding this comment

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

Yeah, and I thought about objecting to that one on the same grounds. In retrospect I regret not doing so.

I see no issue with not using the attr-table. The attr-table is not the UR-source of the information. It is instead a cache of a non-trivial calculation. Avoiding it by directly using one of the inputs to that calculation because doing so gives us a fast-path for what is by far the most common case seems perfectly fine.

@@ -233,7 +233,6 @@ inline bool G1CollectedHeap::is_obj_dead_full(const oop obj) const {
}

inline bool G1CollectedHeap::is_humongous_reclaim_candidate(uint region) {
assert(_hrm.at(region)->is_starts_humongous(), "Must start a humongous object");

Choose a reason for hiding this comment

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

I think I like the semantic requirement that this only be applied to starts-humongous regions. Unless there is some future change that needs this removal (and not just because of the change to G1FreeHumongousRegionClosure::do_heap_region that I don't like), then I'd prefer it stay.

Copy link
Member Author

Choose a reason for hiding this comment

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

There are no other uses in the near future. However, this method doesn't really require that as a pre-condition, even before this PR.

Choose a reason for hiding this comment

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

That it doesn't (currently) require that is arguably an implementation detail. I'm speaking of the intended semantics of the function. I think it's a query about the region that corresponds to a humongous object. It's placed near other predicates on objects. That its argument is a region rather than an oop is an inconsistency that arises from how it's being used. Maybe it's misplaced here?

@albertnetymk
Copy link
Member Author

Added a micro benchmark and some results to the ticket. On my box, this PR reduces the relevant phase length by ~50%.

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.

Still good.

Copy link

@kimbarrett kimbarrett 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 optional suggestion.

if (!is_reclaimable(region_idx)) {
return false;
}
G1CollectedHeap* g1h = G1CollectedHeap::heap();

Choose a reason for hiding this comment

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

Maybe look up the heap once at closure construction time, caching it in a data member?

@albertnetymk
Copy link
Member Author

Thanks for the review.

/integrate

@openjdk
Copy link

openjdk bot commented Sep 19, 2022

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

  • 8ff2c26: 8293942: [JVMCI] data section entries must be 4-byte aligned on AArch64
  • 6e23b43: 8293502: (fc) FileChannel::transfer methods fail to copy /proc files on Linux
  • 1f9ff41: 8292297: Fix up loading of override java.security properties file
  • 64b96e5: 8293811: Provide a reason for PassFailJFrame.forceFail
  • f91762f: 8293965: Code signing warnings after JDK-8293550
  • 8082c24: 8054572: [macosx] JComboBox paints the border incorrectly
  • b920d29: 8271328: User is able to choose the color after disabling the color chooser.
  • 5725a93: 8293879: Remove unnecessary castings in jdk.hotspot.agent
  • ab7f58a: 6286501: JTabbedPane throws NPE from its stateChanged listener in particular case
  • d41f69f: 8293849: PrintIdealPhase in compiler directives file is ignored when used with other compile commands
  • ... and 1 more: https://git.openjdk.org/jdk/compare/a93cf926356b974b8fc5a97d230a15bad066ac2a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 19, 2022

@albertnetymk Pushed as commit 4020ed5.

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

@albertnetymk albertnetymk deleted the g1-entail-2 branch September 19, 2022 18:06
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
3 participants