-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8237842: Separate definitions for default cache line and padding sizes #16973
8237842: Separate definitions for default cache line and padding sizes #16973
Conversation
👋 Welcome back shade! A progress list of the required criteria for merging this PR into |
The *2 has been a contentious point for a long time. This is what I think happened: In 'JDK-8049737: Contended Locking reorder and cache line bucket' DEFAULT_CACHE_LINE was increased from 64 to 128. This was done for the ObjectMonitors, but it had an effect on other data structures in other parts of the JVM (Esp. in the GC). There were performance measurements done to try to see if the 64 to 128 change made any difference, but AFAIK, no performance difference could be seen, but the *2 change was left in place anyways. And then 'JDK-8235931: add OM_CACHE_LINE_SIZE and use smaller size on SPARCv9 and X64' came along and changed the ObjectMonitor code to use its own define without the *2 but leaving the DEFAULT_CACHE_LINE_SIZE and padding code to still use *2! We have asked Intel if really should be padding with two cache lines as we say here:
and their answer was that their hardware stopped doing that over 10 years ago (this question was asked a few years ago). For ZGC we tried to poke at his a bit but gave up and added our own:
So, with all that said. Do we really need to keep this *2 in the x64 code? |
Maybe, maybe not. Anyhow, let's not change multiple things at the same time. I am provisionally good with dropping What this change does is clearly separating the notions of "this is what we expect the cache line to be on given platform" ( This PR effectively renames |
Sure. It think it is a good patch. However, given that you added this commment:
Do you have anything that backs up the claim that this is the case for "current implementations"? Maybe @sviswa7 can help answering if this is still the case for Intel hardware? |
I was merely trying to explain why Again, I don't think this PR should be discussing |
Well I bring this up because you are adding a comment that further sediments the understanding of the need to use *2. As I said I think the patch looks good and I'm just taking the opportunity to talk about this now that someone is yet again juggling around this *2 value. Changing to "some" is probably a good idea. |
@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 no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Yes, true. I rewrote the comment to hopefully much weaker wording that now implies we are not actually that sure |
My few cents about |
Yes, I think the intent was the same: cater for weird prefetcher interactions.
Sure, I think this PR covers these paths too, or am I missing something there? |
If intention of original changes (add padding) was to avoid false sharing why we do it only for x64? From JDK-8049737:
|
Orignal changes also use double size for SPARCv9. |
I don't understand the question. We add padding for all architectures to avoid false sharing. Avoiding false sharing nominally requires padding by cache line size. That is why the default for |
I submitted the RFE for lifting the |
@dcubed-ojdk, as author of JDK-8049737 changes, do you remember why we use double cacheline for padding? |
From my understanding: |
Thanks, Sandhya. I think I found the statement that I was remembering:
|
Folks, I submitted https://bugs.openjdk.org/browse/JDK-8321481 yesterday to figure out the padding situation on x86_64. Please migrate your comments about Let's not allow to scope creep here. This PR is very specifically for splitting the definitions without the actual value changes, and it allows to clearly set the padding size if we decide it should not really match the cache line size. |
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.
Agree.
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 need this too.
Lets ship this.
@shipilev this pull request can not be integrated into git checkout JDK-8237842-cache-line-padding-defs
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
Sorry, I've been pretty much off the air w.r.t e-mail due to problems with my MBP13. We used double cache line size way back then because some hardware fetched two cache Way back in the time frame of JDK-8049737 I wrote some micro benchmarks that we tested |
I had to resolve some merge conflicts in |
/integrate |
Going to push as commit dd517c6.
Your commit was automatically rebased without conflicts. |
JDK-8321137 needs a clean separation between cache line sizes and padding sizes. At least on x86, there is a wrinkle with "assuming" the cache line size is 128 bytes to cater for prefetchers. Cleanly separating cache line size and padding size resolves this. I rewrote uses of
DEFAULT_CACHE_LINE_SIZE
in padding contexts to new macro.The goal for this patch is to avoid actual values changes as much as possible. One of the changes come from cleaning up some of the old cases in x86 definition, thus simplifying the definition. I think the LP64 split is still useful there.
Additional testing:
tier{1,2}
tier{1,2}
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/16973/head:pull/16973
$ git checkout pull/16973
Update a local copy of the PR:
$ git checkout pull/16973
$ git pull https://git.openjdk.org/jdk.git pull/16973/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 16973
View PR using the GUI difftool:
$ git pr show -t 16973
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/16973.diff
Webrev
Link to Webrev Comment