Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8354347

Increase the default padding size for aarch64 in JDK code.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 25
    • 21, 25
    • hotspot
    • master
    • aarch64

      On aarch64, DEFAULT_PADDING_SIZE is defined to be the DEFAULT_CACHE_LINE_SIZE.[https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/globalDefinitions_aarch64.hpp#L48-L49] That definition is insufficient to avoid false sharing in the face of hardware prefetchers.

      If two fields are on two adjacent cache lines, a read of the first field may trigger a hardware prefetcher to read the next line, bringing the second field into the cache of requestor of the first field. Then when a different core reads the second field it will have to negotiate with the cache that accidentally holds the second field. Instead of having the second field live in the cache of the reader of that field.

      It is enough to pad the second field by two cache lines, since even if a prefetcher reads the cache line after the first field, the second field can live undisturbed in the cache of the core that uses that second field.

      The x86 side of the house [https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/globalDefinitions_x86.hpp#L46-L55] already uses two cache lines as the DEFAULT_PADDING_SIZE, with a comment about why two cache lines of padding might be needed. Similarly, ContendedPaddingWidth, for padding contended Java fields, defaults to 128 (two cache lines on aarch64), and can be changed from the command line, or in vm_version_aarch64.cpp.

            pbk Peter Kessler
            pbk Peter Kessler
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: