-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8345659: Fix broken alignment after ReservedSpace splitting in GC code #22602
8345659: Fix broken alignment after ReservedSpace splitting in GC code #22602
Conversation
👋 Welcome back stefank! A progress list of the required criteria for merging this PR into |
@stefank 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:
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 69 new commits pushed to the
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 |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if doing the same for first_part
makes it more symmetric/readable.
I think it is unclear if that would help readability or not. The |
I meant sth like |
You are right, that seems like a good thing to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
The alignment always require extra thinking as it has multiple meanings. It is both the required alignment of the base, but it is also the granularity / alignment of the size. But we have the same meaning when it comes to HeapAlignment, SpaceAlignment and GenAlignment. So the partition size does not break this invariant.
It is unfortunate that we do not assert that these invariants are maintained when we partition a reserved space. Something like:
ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment, size_t page_size,
bool special, bool executable) : _fd_for_heap(-1) {
assert((size % os::vm_allocation_granularity()) == 0,
"size not allocation aligned");
+ assert(alignment != 0, "must be set");
+ assert(size % alignment == 0, "must be");
+ assert((uintptr_t)base % alignment == 0, "must be");
initialize_members(base, size, alignment, page_size, special, executable);
}
But I know you are working on refactoring and improving the ReservedSpace. Let us hope we can make this more robust in the future.
I don't think that this is a strict requirement throughout the JVM's usage of ReservedSpace. AFAIU, the alignment only strictly applies to the base pointer, but some users has also has an 'alignment' requirement (as opposed to a 'page_size' requirement) on the size. Let's take an extra round thinking about that for the ReservedSpace rewrites.
Yes, I have extra verification in my other patch. |
Thanks both for reviewing! |
Yes, the users might not have these requirements, but the current implementation of ReservedSpace enforces it. It might be nice to separate these two properties. AFAICT all paths go through Of course We have uses from the outside that do not care about the alignment, and they will get some page_size (or |
All good points, Axel. |
So, for completeness of the discussion. AFAICT, we have |
/integrate |
Going to push as commit c34b87c.
Your commit was automatically rebased without conflicts. |
The Serial and Parallel GCs create a ReservedSpace for the total heap and then splits it into a young generation ReservedSpace and an old generation ReservedSpace. The latter operation creates an ReservedSpace with an alignment that doesn't match the base address. This bug is benign because the ReservedSpaces are short-lived and we don't look at the alignment. However, if we are to add stricter checks when creating ReservedSpaces we need to fix this.
Tested with tier1-3
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22602/head:pull/22602
$ git checkout pull/22602
Update a local copy of the PR:
$ git checkout pull/22602
$ git pull https://git.openjdk.org/jdk.git pull/22602/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22602
View PR using the GUI difftool:
$ git pr show -t 22602
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22602.diff
Using Webrev
Link to Webrev Comment