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

Dynamic parallel reference processing support for Parallel GC

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 17
    • hotspot
    • gc
    • behavioral
    • low
    • Hide
      This change will make ParallelRefProcEnabled true by default for Parallel GC and the number of threads to be adjusted based on the same policy as G1.
      Since we have not heard complaints for the same heuristics for G1, there do not seem any issues beyond making this phase of garbage collection potentially faster.
      Show
      This change will make ParallelRefProcEnabled true by default for Parallel GC and the number of threads to be adjusted based on the same policy as G1. Since we have not heard complaints for the same heuristics for G1, there do not seem any issues beyond making this phase of garbage collection potentially faster.
    • add/remove/modify command line option
    • Implementation

      Summary

      Make the option ParallelRefProcEnabled to default to true for Parallel GC. Make reference processing for Parallel GC use the same heuristics as for G1 to calculate the number of threads to use for this phase.

      Problem

      Today, the behaviour of G1 and Parallel GC differs in that in G1 the option ParallelRefProcEnabled is true by default and uses some heuristics to set the amount of worker threads depending on the actually observed reference count. Neither is currently true for Parallel GC: the default for ParallelRefProcEnabled is false, and if the user manually enables it, all available gc worker threads will be used.

      Solution

      Set ParallelRefProcEnabled to true by default and remove the special handling in Parallel GC so that it also uses the same ergonomic calculations as G1 for thread counts.

      This change is positive in two ways: First it will make both garbage collectors use the same defaults and heuristics, second it will by default increase performance for Parallel GC when processing many references.

      Specification

      diff --git a/src/hotspot/share/gc/parallel/parallelArguments.cpp b/src/hotspot/share/gc/parallel/parallelArguments.cpp
      index 185d2266796..2ffffdf1455 100644
      --- a/src/hotspot/share/gc/parallel/parallelArguments.cpp
      +++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp
      @@ -85,6 +85,10 @@ void ParallelArguments::initialize() {
         if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
           FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
         }
      +
      +  if (FLAG_IS_DEFAULT(ParallelRefProcEnabled) && ParallelGCThreads > 1) {
      +    FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
      +  }
       }
      
       // The alignment used for boundary between young gen and old gen

            lkorinth Leo Korinth
            tschatzl Thomas Schatzl
            Kim Barrett, Stefan Johansson, Thomas Schatzl
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: