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

8253286: Use expand_exact() instead of expand_at() for fixed requests in G1 #235

Closed
wants to merge 3 commits into from

Conversation

kstefanj
Copy link
Contributor

@kstefanj kstefanj commented Sep 18, 2020

Hi all,

Please review this small cleanup that uses expand_exact() rather than expand_at() when requesting a specific region. This will ensure that we get exactly the requested region.

Testing:
tier1-2 alone and 3-5 with other changes.


Progress

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

Issue

  • JDK-8253286: Use expand_exact() instead of expand_at() for fixed requests in G1

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 18, 2020

👋 Welcome back sjohanss! 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 Sep 18, 2020

@kstefanj 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 (add|remove) "label" command.

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Sep 18, 2020
@kstefanj kstefanj marked this pull request as ready for review Sep 18, 2020
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 18, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 18, 2020

Webrevs

Copy link
Contributor

@tschatzl tschatzl left a comment

Makes sense. Lgtm.

@openjdk
Copy link

openjdk bot commented Sep 18, 2020

@kstefanj This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

8253286: Use expand_exact() instead of expand_at() for fixed requests in G1

Reviewed-by: tschatzl, ayang
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

There are currently no new commits on the master branch since the last update of the source branch of this PR. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you would like to avoid potential automatic rebasing, specify the current head hash when integrating, like this: /integrate bba948f0ff8facddfb5efb7320ff2594c62e5aef.

➡️ 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 18, 2020
@shipilev
Copy link
Member

shipilev commented Sep 18, 2020

Commit message still has "instaed" typo, probably due to PR title here?

@kstefanj kstefanj changed the title 8253286: Use expand_exact() instaed of expand_at() for fixed requests in G1 8253286: Use expand_exact() instead of expand_at() for fixed requests in G1 Sep 18, 2020
@mlbridge
Copy link

mlbridge bot commented Sep 21, 2020

Mailing list message from Thomas Schatzl on hotspot-gc-dev:

Hi Stefan,

On 18.09.20 21:56, Stefan Johansson wrote:

On Fri, 18 Sep 2020 16:22:00 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

we should never fail this expand

I think I am missing some background knowledge. I assume `expand_exact()`, in generally, could fail, but for args,
`curr, 1, NULL` here, it will not fail, because ... The "because" part should be in the comments right above the call.
As for the post-assert, `_regions.get_by_index(curr) != NULL && is_available(curr)`, I think they are already covered
in `expand_exact`.
I like `at(curr)->is_free()` better, since the current function, `find_highest_free`, should return a region (by index)
that's free.

Looking at this again, I think the change in HeapRegionManager::find_highest_free() is not good.

While the call should never fail (it is done when allocating archive regions at VM startup when the heap is completely
empty), the caller handles that - and does not allocate the archive regions at all. Consider the use case where you
start with a small heap, but a huge CDS archive (maybe even larger than the heap). This should still continue working
without CDS usage.

@tschatzl, not sure I follow the use case you describe and how using `expand_exact()` will differ from `expand_at()`.
Since we're searching backwards in `HeapRegionManager::find_highest_free()` we know `expand_at()` can only expand
precisely the requested region (all potentially higher regions must be in use already). If for some reason
`expand_at()` would have expanded another region in the old code, this would be a bug, because we return the requested
index.

I have been concerned about the commit potentially failing, and the
result of that not being passed on to the caller. However, if a commit
fails, we exit the VM anyway. So I'll retract that objection and mark it
as reviewed.

Thomas

Copy link
Contributor

@tschatzl tschatzl left a comment

Re-approve (if needed) after latest discussion.

@kstefanj
Copy link
Contributor Author

kstefanj commented Sep 21, 2020

Re-approve (if needed) after latest discussion.

Thanks Thomas

@openjdk
Copy link

openjdk bot commented Sep 21, 2020

@kstefanj 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 8253286-use-expand-exact
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 Sep 21, 2020
@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 Sep 21, 2020
@kstefanj
Copy link
Contributor Author

kstefanj commented Sep 21, 2020

/integrate

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

openjdk bot commented Sep 21, 2020

@kstefanj Pushed as commit edc14f9.

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

@kstefanj kstefanj deleted the 8253286-use-expand-exact branch Sep 22, 2020
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