aarch64: Rationalize DEFAULT_PADDING_SIZE with ContendedPaddingWidth

Aleksey Shipilev shipilev at amazon.de
Wed Mar 19 15:58:36 UTC 2025


Hi,

On 19.03.25 00:58, Peter Kessler OS wrote:
> Similarly, ContendedPaddingWidth specifies the padding that should be put before a Java field to 
> avoid false sharing.  For all platforms that is set to 128 bytes, but it can be changed from the 
> java command line.[3]

ContendedPaddingWidth is a conservative estimate.

Look for the uses of ContendedPaddingWidth, it is overriden by VM as well like this:

   if (FLAG_IS_DEFAULT(ContendedPaddingWidth) && (dcache_line > ContendedPaddingWidth)) {
     ContendedPaddingWidth = dcache_line;
   }

Arguably, we want to drop the `dcache_line > CPW` check and trust the dcache line size?

> I would like to rationalize the padding for aarch64 C++ fields with the padding for Java fields.  
> The change is easy: double the size of DEFAULT_PADDING_SIZE in globalDefinitions_aarch64.hpp.  But I 
> am curious why the difference exists for aarch64 and not for x86, and if there implications that 
> should be considered before submitting a pull request.

Last time we looked at this, we were actually suspecting we should go the other way around: drop 
double padding on x86: https://bugs.openjdk.org/browse/JDK-8321481. But this is arch-specific, so if 
known AArch64 arches are affected by this, it would be interesting to try and double it.

Thanks,
-Aleksey


More information about the hotspot-runtime-dev mailing list