< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahWorkerPolicy.cpp

Print this page
rev 10522 : [backport] Added logging for the number of workers used for GC cycles
rev 10637 : [backport] Purge partial heuristics and connection matrix infrastructure


  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
  27 #include "gc_implementation/shenandoah/shenandoahWorkerPolicy.hpp"
  28 #include "runtime/thread.hpp"
  29 
  30 uint ShenandoahWorkerPolicy::_prev_par_marking     = 0;
  31 uint ShenandoahWorkerPolicy::_prev_conc_marking    = 0;
  32 uint ShenandoahWorkerPolicy::_prev_conc_evac       = 0;
  33 uint ShenandoahWorkerPolicy::_prev_fullgc          = 0;
  34 uint ShenandoahWorkerPolicy::_prev_degengc         = 0;
  35 uint ShenandoahWorkerPolicy::_prev_stw_partial     = 0;
  36 uint ShenandoahWorkerPolicy::_prev_conc_update_ref = 0;
  37 uint ShenandoahWorkerPolicy::_prev_par_update_ref  = 0;
  38 uint ShenandoahWorkerPolicy::_prev_conc_cleanup    = 0;
  39 
  40 uint ShenandoahWorkerPolicy::calc_workers_for_init_marking() {
  41   uint active_workers = (_prev_par_marking == 0) ? ParallelGCThreads : _prev_par_marking;
  42 
  43   _prev_par_marking =
  44     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  45                                             active_workers,
  46                                             Threads::number_of_non_daemon_threads());
  47   return _prev_par_marking;
  48 }
  49 
  50 uint ShenandoahWorkerPolicy::calc_workers_for_conc_marking() {
  51   uint active_workers = (_prev_conc_marking == 0) ?  ConcGCThreads : _prev_conc_marking;
  52   _prev_conc_marking =
  53     AdaptiveSizePolicy::calc_active_conc_workers(ConcGCThreads,
  54                                                  active_workers,
  55                                                  Threads::number_of_non_daemon_threads());
  56   return _prev_conc_marking;
  57 }
  58 
  59 // Reuse the calculation result from init marking
  60 uint ShenandoahWorkerPolicy::calc_workers_for_final_marking() {
  61   return _prev_par_marking;
  62 }
  63 
  64 // Calculate workers for concurrent evacuation (concurrent GC)
  65 uint ShenandoahWorkerPolicy::calc_workers_for_conc_evac() {
  66   uint active_workers = (_prev_conc_evac == 0) ? ConcGCThreads : _prev_conc_evac;
  67   _prev_conc_evac =
  68     AdaptiveSizePolicy::calc_active_workers(ConcGCThreads,
  69                                             active_workers,
  70                                             Threads::number_of_non_daemon_threads());
  71   return _prev_conc_evac;
  72 }
  73 
  74 // Calculate workers for parallel fullgc
  75 uint ShenandoahWorkerPolicy::calc_workers_for_fullgc() {
  76   uint active_workers = (_prev_fullgc == 0) ?  ParallelGCThreads : _prev_fullgc;
  77   _prev_fullgc =
  78     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  79                                             active_workers,
  80                                             Threads::number_of_non_daemon_threads());
  81   return _prev_fullgc;
  82 }
  83 
  84 // Calculate workers for Stop-the-world partial GC
  85 uint ShenandoahWorkerPolicy::calc_workers_for_stw_partial() {
  86   uint active_workers = (_prev_stw_partial == 0) ? ParallelGCThreads : _prev_stw_partial;
  87   _prev_stw_partial =
  88     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  89                                             active_workers,
  90                                             Threads::number_of_non_daemon_threads());
  91   return _prev_stw_partial;
  92 }
  93 
  94 // Calculate workers for concurrent reference update
  95 uint ShenandoahWorkerPolicy::calc_workers_for_conc_update_ref() {
  96   uint active_workers = (_prev_conc_update_ref == 0) ? ConcGCThreads : _prev_conc_update_ref;
  97   _prev_conc_update_ref =
  98     AdaptiveSizePolicy::calc_active_workers(ConcGCThreads,
  99                                             active_workers,
 100                                             Threads::number_of_non_daemon_threads());
 101   return _prev_conc_update_ref;
 102 }
 103 
 104 // Calculate workers for parallel reference update
 105 uint ShenandoahWorkerPolicy::calc_workers_for_final_update_ref() {
 106   uint active_workers = (_prev_par_update_ref == 0) ? ParallelGCThreads : _prev_par_update_ref;
 107   _prev_par_update_ref =
 108     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
 109                                             active_workers,
 110                                             Threads::number_of_non_daemon_threads());
 111   return _prev_par_update_ref;
 112 }
 113 
 114 // Calculate workers for parallel degenerated gc
 115 uint ShenandoahWorkerPolicy::calc_workers_for_stw_degenerated() {
 116   uint active_workers = (_prev_degengc == 0) ?  ParallelGCThreads : _prev_degengc;
 117   _prev_degengc =
 118     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
 119                                             active_workers,
 120                                             Threads::number_of_non_daemon_threads());
 121   return _prev_degengc;
 122 }
 123 
 124 uint ShenandoahWorkerPolicy::calc_workers_for_conc_preclean() {
 125   return _prev_conc_marking;
 126 }
 127 
 128 uint ShenandoahWorkerPolicy::calc_workers_for_conc_cleanup() {
 129   uint active_workers = (_prev_conc_cleanup == 0) ? ConcGCThreads : _prev_conc_cleanup;
 130   _prev_conc_cleanup =
 131           AdaptiveSizePolicy::calc_active_workers(ConcGCThreads,
 132                                                   active_workers,
 133                                                   Threads::number_of_non_daemon_threads());
 134   return _prev_conc_cleanup;
 135 }


  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 
  26 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
  27 #include "gc_implementation/shenandoah/shenandoahWorkerPolicy.hpp"
  28 #include "runtime/thread.hpp"
  29 
  30 uint ShenandoahWorkerPolicy::_prev_par_marking     = 0;
  31 uint ShenandoahWorkerPolicy::_prev_conc_marking    = 0;
  32 uint ShenandoahWorkerPolicy::_prev_conc_evac       = 0;
  33 uint ShenandoahWorkerPolicy::_prev_fullgc          = 0;
  34 uint ShenandoahWorkerPolicy::_prev_degengc         = 0;

  35 uint ShenandoahWorkerPolicy::_prev_conc_update_ref = 0;
  36 uint ShenandoahWorkerPolicy::_prev_par_update_ref  = 0;
  37 uint ShenandoahWorkerPolicy::_prev_conc_cleanup    = 0;
  38 
  39 uint ShenandoahWorkerPolicy::calc_workers_for_init_marking() {
  40   uint active_workers = (_prev_par_marking == 0) ? ParallelGCThreads : _prev_par_marking;
  41 
  42   _prev_par_marking =
  43     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  44                                             active_workers,
  45                                             Threads::number_of_non_daemon_threads());
  46   return _prev_par_marking;
  47 }
  48 
  49 uint ShenandoahWorkerPolicy::calc_workers_for_conc_marking() {
  50   uint active_workers = (_prev_conc_marking == 0) ?  ConcGCThreads : _prev_conc_marking;
  51   _prev_conc_marking =
  52     AdaptiveSizePolicy::calc_active_conc_workers(ConcGCThreads,
  53                                                  active_workers,
  54                                                  Threads::number_of_non_daemon_threads());
  55   return _prev_conc_marking;
  56 }
  57 
  58 // Reuse the calculation result from init marking
  59 uint ShenandoahWorkerPolicy::calc_workers_for_final_marking() {
  60   return _prev_par_marking;
  61 }
  62 
  63 // Calculate workers for concurrent evacuation (concurrent GC)
  64 uint ShenandoahWorkerPolicy::calc_workers_for_conc_evac() {
  65   uint active_workers = (_prev_conc_evac == 0) ? ConcGCThreads : _prev_conc_evac;
  66   _prev_conc_evac =
  67     AdaptiveSizePolicy::calc_active_conc_workers(ConcGCThreads,
  68                                                  active_workers,
  69                                                  Threads::number_of_non_daemon_threads());
  70   return _prev_conc_evac;
  71 }
  72 
  73 // Calculate workers for parallel fullgc
  74 uint ShenandoahWorkerPolicy::calc_workers_for_fullgc() {
  75   uint active_workers = (_prev_fullgc == 0) ?  ParallelGCThreads : _prev_fullgc;
  76   _prev_fullgc =
  77     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  78                                             active_workers,
  79                                             Threads::number_of_non_daemon_threads());
  80   return _prev_fullgc;
  81 }
  82 










  83 // Calculate workers for concurrent reference update
  84 uint ShenandoahWorkerPolicy::calc_workers_for_conc_update_ref() {
  85   uint active_workers = (_prev_conc_update_ref == 0) ? ConcGCThreads : _prev_conc_update_ref;
  86   _prev_conc_update_ref =
  87     AdaptiveSizePolicy::calc_active_conc_workers(ConcGCThreads,
  88                                                  active_workers,
  89                                                  Threads::number_of_non_daemon_threads());
  90   return _prev_conc_update_ref;
  91 }
  92 
  93 // Calculate workers for parallel reference update
  94 uint ShenandoahWorkerPolicy::calc_workers_for_final_update_ref() {
  95   uint active_workers = (_prev_par_update_ref == 0) ? ParallelGCThreads : _prev_par_update_ref;
  96   _prev_par_update_ref =
  97     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
  98                                             active_workers,
  99                                             Threads::number_of_non_daemon_threads());
 100   return _prev_par_update_ref;
 101 }
 102 
 103 // Calculate workers for parallel degenerated gc
 104 uint ShenandoahWorkerPolicy::calc_workers_for_stw_degenerated() {
 105   uint active_workers = (_prev_degengc == 0) ?  ParallelGCThreads : _prev_degengc;
 106   _prev_degengc =
 107     AdaptiveSizePolicy::calc_active_workers(ParallelGCThreads,
 108                                             active_workers,
 109                                             Threads::number_of_non_daemon_threads());
 110   return _prev_degengc;
 111 }
 112 
 113 uint ShenandoahWorkerPolicy::calc_workers_for_conc_preclean() {
 114   return _prev_conc_marking;
 115 }
 116 
 117 uint ShenandoahWorkerPolicy::calc_workers_for_conc_cleanup() {
 118   uint active_workers = (_prev_conc_cleanup == 0) ? ConcGCThreads : _prev_conc_cleanup;
 119   _prev_conc_cleanup =
 120           AdaptiveSizePolicy::calc_active_conc_workers(ConcGCThreads,
 121                                                        active_workers,
 122                                                        Threads::number_of_non_daemon_threads());
 123   return _prev_conc_cleanup;
 124 }
< prev index next >