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

8259776: Remove ParallelGC non-CAS oldgen allocation #2101

Closed
wants to merge 4 commits into from

Conversation

kimbarrett
Copy link

@kimbarrett kimbarrett commented Jan 15, 2021

Please review this change to ParallelGC oldgen allocation. There were two
variants, one using CAS on the _top member of the mutable space, the other
requiring locking or other forms of mutual exclusion.

We don't need both variants. The non-CAS variant is only used in a few
places, where the cost of an extra CAS doesn't matter. What does matter is
that having two variants, which must not be used concurrently, makes the
code larger, more complex, and harder to verify. (This change came out of
analyzing JDK-8259271. No problems were found (or expected), so this change
is not expected to impact that bug. But because of the two variants, the
possibility of unexpected interact needed to be examined.)

The non-CAS allocation support has been removed, with PSOldGen::allocate now
implemented using the CAS-based allocation. The cas_ prefix naming
convention is retained for the internals for clarity.

While looking at this, noticed and removed a couple of lingering references
to the class AdjoiningGenerations, which no longer exists after JDK-8243146.

Testing:
mach5 tier1-5


Progress

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

Issue

  • JDK-8259776: Remove ParallelGC non-CAS oldgen allocation

Reviewers

Download

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 15, 2021

👋 Welcome back kbarrett! 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 15, 2021
@openjdk
Copy link

openjdk bot commented Jan 15, 2021

@kimbarrett 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 15, 2021
@mlbridge
Copy link

mlbridge bot commented Jan 15, 2021

Webrevs

// Allocation. We report all successful allocations to the size policy
// Note that the perm gen does not use this method, and should not!
HeapWord* allocate(size_t word_size);
HeapWord* allocate(size_t word_size) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Before this change there has been a small semantical difference between allocate() and par_allocate(). The former also updated the size policy, which seem to be missing now in ParallelScavengeHeap::mem_allocate_old_gen() and ParallelScavengeHeap::failed_mem_allocate().

Copy link
Author

Choose a reason for hiding this comment

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

Oops, I forgot about that and got overly enthusiastic about code deletion. Thanks for spotting it.

@@ -401,15 +401,15 @@ ParallelScavengeHeap::death_march_check(HeapWord* const addr, size_t size) {
HeapWord* ParallelScavengeHeap::mem_allocate_old_gen(size_t size) {
if (!should_alloc_in_eden(size) || GCLocker::is_active_and_needs_gc()) {
// Size is too big for eden, or gc is locked out.
return old_gen()->allocate(size);
return old_gen()->allocate_and_record(size);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have kind of preferred if allocate_and_record were a helper method here in ParallelScavengeHeap since the recording seems to be entirely a thing of the PSH and not of the old gen, and the implementation of that method just calls back in here, but I am good with this too.

@openjdk
Copy link

openjdk bot commented Jan 18, 2021

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

8259776: Remove ParallelGC non-CAS oldgen allocation

Reviewed-by: tschatzl, sjohanss

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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 18, 2021
@mlbridge
Copy link

mlbridge bot commented Jan 18, 2021

Mailing list message from Kim Barrett on hotspot-gc-dev:

On Jan 18, 2021, at 5:23 AM, Thomas Schatzl <tschatzl at openjdk.java.net> wrote:
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 404:

402: if (!should_alloc_in_eden(size) || GCLocker::is_active_and_needs_gc()) {
403: // Size is too big for eden, or gc is locked out.
404: return old_gen()->allocate_and_record(size);

I would have kind of preferred if `allocate_and_record` were a helper method here in `ParallelScavengeHeap` since the recording seems to be entirely a thing of the PSH and not of the old gen, and the implementation of that method just calls back in here, but I am good with this too.

I like this suggestion.

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.

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.

Nice cleanup.

@kimbarrett
Copy link
Author

Thanks @tschatzl and @kstefanj for reviews.

@kimbarrett
Copy link
Author

/integrate

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

openjdk bot commented Jan 23, 2021

@kimbarrett Pushed as commit 06348df.

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

@kimbarrett kimbarrett deleted the nocas_alloc branch January 23, 2021 22: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
3 participants