-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8253779: Amalloc may be wasting space by overaligning #4732
Conversation
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
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 replied to some "outdated" conversation threads. I'm not sure how that will show up in the UI or in the Skara emails. GitHub seems to be aggressively hiding some of the conversations in the "Files changed" view, which seems pretty unhelpful.
Yuck! The handling of the replies to "outdated" conversations seems pretty horrible. In "conversation" mode they remain attached to the original change, while in "files changed" mode they don't show up at all. Sorry this seems to be kind of a mess. I also have no idea why these got tagged as "outdated". |
I think they get outdated once a new push is made. I agree that this is confusing. The way we work, the "outdated" tag has no meaning. |
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 like this fix and the suggested naming cleanups. LGTM.
Since you are talking about potential improvements:
I was always a bit unhappy with this arena code. E.g. I disliked how, instead of letting the Arena itself deal with its chunk chain, it exposed the chain internals and let the Marks modify the chunks from outside. This always seemed wrong to me.
There may be more potential improvements:
- _hwm and _max should be properties of the chunk, not the arena, and then arguably could be smaller typed offsets instead of pointers.
- I am not sure why we need to keep track of both _first and _current chunk in the arenas. I think one pointer would suffice: just holding the last added chunk, which would serve as starting point to traverse the chain. I may miss something here though, maybe traversal order matters somewhere.
I also disliked how an Arena would always create its first chunk right when constructed, instead of delaying chunk allocation to the first allocation. You always pay upfront even if you don't allocate from the Arena.
If one does all of the above, Arena could maybe shrink to just one member (the top chunk pointer), and then it could be embedded as a value object into Thread instead of having to dynamically create and destroy it. Would be slightly simpler and save one pointer dereferencing when accessing the resource area. You'd also save NMT registration of the Arenas themselves.
Cheers, Thomas
(I also had vague ideas of re-using Metaspace arena code for these hotspot arenas, which share many similarities. But I am not sure if or when I find the time to play with that idea.)
@coleenp 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 48 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 |
One thought, maybe it should keep the alignment adjustable with a diagnostic switch in debug. At least for a little while. Since we may uncover hidden overwrite issues with the reduced alignment. |
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.
2 comments in this view.
I'll try to answer the main comments in one message. I hope I haven't lost any.
|
Okay, sure.
Of course, sorry, I was not suggesting someone other should do it. I was just interested in your thoughts.
Change looks still good to me. ..Thomas |
Thanks Thomas! Since Arena's haven't been a problem we haven't actually thought about them, other than this RFE and now the new RFE JDK-8270179. |
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.
Looks good.
Thanks Kim. Thank you for the suggestions on other improvements. |
Going to push as commit ac75a53.
Your commit was automatically rebased without conflicts. |
Thanks to @kimbarrett for noticing this. The alignment was changed to 64 bits for 32 bit platforms, but overalign for 64 bits platforms. I changed this to BytesPerLong to cover both, since the long case is why it was changed on 32 bits in the first place in JDK-4526490.
I also removed Amalloc_D since I don't know what D stands for and it's the same as Amalloc_4. That's not a great name either. I'm open to suggestions!
Tested with tier1-3.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/4732/head:pull/4732
$ git checkout pull/4732
Update a local copy of the PR:
$ git checkout pull/4732
$ git pull https://git.openjdk.java.net/jdk pull/4732/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 4732
View PR using the GUI difftool:
$ git pr show -t 4732
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/4732.diff