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
8256732: Zero: broken +ZeroTLAB exposes badly initialized memory #1343
8256732: Zero: broken +ZeroTLAB exposes badly initialized memory #1343
Conversation
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
But isn't the memory returned by ThreadLocalAllocBuffer::allocate implicitly already zeroed when ZeroTLAB is specified? |
No! That tripped me too! The comment at |
But is that comment true? Does it really mean "The memory is NOT initialized (unless ZeroTLAB has been set)" ? If ZeroTLAB is not actually zeroing all memory returned via TLAB then something seems far more broken than just Zero! |
@shipilev This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@shipilev This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! |
I think I figured it out: Zero picks the short stick with space mangling. The rest of Hotspot code does not call that method directly, and instead goes through various |
Anyone? :) |
@shipilev 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 211 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 |
Sorry clicked too soon and hadn't added this comment. :) I still think there is some underlying bug here with regards to ZeroTLAB but otherwise the changes you have made seem okay, and the proof as always is in the testing, so I've approved it. Cheers, |
ZeroTLAB seems to do nothing useful for performance on any platform, even AArch64 which has bulk memory zeroing instructions. Can we not just nuke it? |
Yes, that was my thought too, when I was looking through this code. |
/integrate |
@shipilev Since your change was applied there have been 217 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit dc93138. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Looks like memory is badly initialized when
-XX:+ZeroTLAB
is specified.Manifests like this:
The cause is simple: Zero calls
ThreadLocalAllocBuffer::allocate
:...which actually does mangle the object space in debug builds:
So if we do
+ZeroTLAB
in debug builds, Zero skips initializing the object body, and gets scrambled memory for newly allocated object. Then everything breaks.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1343/head:pull/1343
$ git checkout pull/1343