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

Add paddings for TaskQueueSuper to reduce false-sharing cache contention

XMLWordPrintable

    • gc
    • b01
    • generic
    • generic

        This ticket actually covers a tiny part from JDK-8243326, Cleanup use of volatile in taskqueue code.

        class TaskQueueSuper has two volatile variables: _bottom and _age declared side by side, and the instances are widely used by g1 and cms functions, while many atomic functions operate on these two variables during the execution of the known work stealing algorithm among a number of threads,e.g. decided by ParallelGCThreads. Therefore, false-share caching contention would occur here and there. The proposed code change can be safe enough as it does not change any function explicitly, and performance measurement on benchmarks and small cases show positive effect steadily (please note it is difficult to completely reproduce the work-stealing algorithm and cache contentions in small test cases).

        A tiny part of JDK-8243326 added padding around the two variables with DEFINE_PAD_MINUS_SIZE which fixed the mentioned potential issue by the way. However it is no need to backport the whole patch (https://hg.openjdk.java.net/jdk/jdk/rev/252a1602b4c6) due to the complex context especially the new load/store atomic functions introduced beyond jdk11u.

              qpzhang Patrick Zhang
              qpzhang Patrick Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 1 day
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified