Skip to content

Conversation

@tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Oct 29, 2025

Hi all,

please review this cleanup of the region attribute registration methods.

Testing: gha

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-8370807: G1: Improve region attribute table method naming (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 28038

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Hi all, please review this cleanup of the region attribute registration methods. Testing: gha Thanks, Thomas
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 29, 2025

👋 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 29, 2025

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

8370807: G1: Improve region attribute table method naming Reviewed-by: ayang, sjohanss, 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 4 new commits pushed to 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 changed the title 8370807 8370807: G1: Fix comment about not selecting pinned regions into collection set Oct 29, 2025
@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Oct 29, 2025
@openjdk
Copy link

openjdk bot commented Oct 29, 2025

@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 rfr Pull request is ready for review label Oct 29, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 29, 2025

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.

Change looks good, but the bug-title could be updated to reflect that this is not just a change to a comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 29, 2025
@tschatzl tschatzl changed the title 8370807: G1: Fix comment about not selecting pinned regions into collection set 8370807: G1: Improve region attribute table method naming Oct 29, 2025
}

void G1CollectedHeap::register_old_region_with_region_attr(G1HeapRegion* r) {
void G1CollectedHeap::register_old_collection_set_region_with_region_attr(G1HeapRegion* r) {
Copy link
Member

Choose a reason for hiding this comment

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

Why "collection_set" in the name? Is it a precondition that r is in cset?

Copy link
Contributor Author

@tschatzl tschatzl Oct 29, 2025

Choose a reason for hiding this comment

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

It must be a region that is currently being added to the collection set. I.e. registered to the attribute table to be in the collection set.

Copy link
Member

Choose a reason for hiding this comment

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

Then in_cset is a postcondition, not a precondition. The new name seems to suggest the arg (r) is old + in_cset, as a precondition.

Looking at the impl, one can't see anything related to "collection_set" in this context. I'd suggest restoring the original name, but YMMV.

Copy link
Contributor Author

@tschatzl tschatzl Oct 29, 2025

Choose a reason for hiding this comment

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

The set_in_old call is the giveaway - in the region attribute table you only set a region to "Old" if it is

 static const region_type_t Old = 1; // The region is in the collection set and an old region. 

Old regions not in the collection set are just NotInCset.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "Young" and "NewSurvivor" do not have the collection_set tagging because they are always in the collection set (i.e. it's obvious).

I thought it would be good to make it clear in the name that for old regions, we only add (old) regions that are part of the collection set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The attribute table is an accelerator table - it only mirrors information from elsewhere used during GC. So the given region is already(*) in the collection set, but we can't check easily.

(*) Formally, from the code flow it isn't yet - the cardset group this region is contained in (which determines whether the related regions are in) will also be added during the G1CollectionSet::add_group_to_collection_set() call. This would just require some reordering of the calls, but logically it already is. If you really want I can do that in this change too.

Copy link
Member

Choose a reason for hiding this comment

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

So the given region is already(*) in the collection set

If that's indeed precondition, the new name makes sense.

There is assert(!hr->in_collection_set(), in the caller, which is conflicting with this semantic.

If you really want I can do that in this change too.

I'd prefer doing that (new name + new precondition) in another PR, as the current title imply naming changes only, but up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is assert(!hr->in_collection_set(), in the caller, which is conflicting with this semantic.

The reason is that that assert only checks the accelerator table, which must not indicate that we already added it. There is no long form of that in-collections-set check any more, we removed it quite some time ago because we thought it was superfluous.

Copy link
Contributor Author

@tschatzl tschatzl Oct 29, 2025

Choose a reason for hiding this comment

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

So reordering the calls does not change the situation, i.e. there is no long-form check for the condition (i.e. the region is in the collection set already and we are just updating the attribute table).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 29, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 29, 2025
@tschatzl
Copy link
Contributor Author

Thanks @kstefanj @walulyai @albertnetymk for your reviews
/integrate

@openjdk
Copy link

openjdk bot commented Oct 30, 2025

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

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 30, 2025

@tschatzl Pushed as commit 17fd801.

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

@tschatzl tschatzl deleted the submit/8370807-pinned-region-flag-not-propagated branch October 30, 2025 07:40
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