Skip to content
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

Uses 128 bytes padding to prevent false-sharing #191

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

franz1981
Copy link
Collaborator

@franz1981 franz1981 commented Sep 24, 2024

According to Intel Optimisation Manual, using 128 bytes is safer due to the spatial prefetcher - which can bring 2 cache-lines into L2.

see

image

Intel Netburst is pretty old but I've observed something similar with AMD Ryzen with multi-NUMA nodes.

See https://morestina.net/blog/1976/a-close-encounter-with-false-sharing as well

I've been hit by the same in Hyperfoil too, see https://github.com/Hyperfoil/Hyperfoil/pull/374/files#diff-03478637fd75a5eb1aef7f5db3b19db102359afba797e0328580dcc83796b735R40

OpenJDK itself seems to prefer 128 bytes: https://github.com/openjdk/jdk/blob/44024826e52373d1613ec366e3f5a9d5bbaefa41/src/hotspot/share/runtime/globals.hpp#L811

and fallback to the cache line only if the cache line exceed the configured default one, see https://github.com/openjdk/jdk/blob/44024826e52373d1613ec366e3f5a9d5bbaefa41/src/hotspot/cpu/x86/vm_version_x86.cpp#L1940-L1942

@dmlloyd dmlloyd merged commit c24441e into jbossas:main Sep 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants