src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp
changeset 58543 a7a606f6311c
parent 58095 adc72cd1d1f2
child 58679 9c3209ff7550
child 58918 c727d5d4c22e
equal deleted inserted replaced
58542:94fe833a244b 58543:a7a606f6311c
    68   tax *= 3;                          // mark is phase 1 of 3, claim 1/3 of free for it
    68   tax *= 3;                          // mark is phase 1 of 3, claim 1/3 of free for it
    69   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
    69   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
    70 
    70 
    71   restart_with(non_taxable, tax);
    71   restart_with(non_taxable, tax);
    72 
    72 
    73   log_info(gc, ergo)("Pacer for Mark. Expected Live: " SIZE_FORMAT "M, Free: " SIZE_FORMAT
    73   log_info(gc, ergo)("Pacer for Mark. Expected Live: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, "
    74                      "M, Non-Taxable: " SIZE_FORMAT "M, Alloc Tax Rate: %.1fx",
    74                      "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx",
    75                      live / M, free / M, non_taxable / M, tax);
    75                      byte_size_in_proper_unit(live),        proper_unit_for_byte_size(live),
       
    76                      byte_size_in_proper_unit(free),        proper_unit_for_byte_size(free),
       
    77                      byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable),
       
    78                      tax);
    76 }
    79 }
    77 
    80 
    78 void ShenandoahPacer::setup_for_evac() {
    81 void ShenandoahPacer::setup_for_evac() {
    79   assert(ShenandoahPacing, "Only be here when pacing is enabled");
    82   assert(ShenandoahPacing, "Only be here when pacing is enabled");
    80 
    83 
    89   tax = MAX2<double>(1, tax);        // never allocate more than GC processes during the phase
    92   tax = MAX2<double>(1, tax);        // never allocate more than GC processes during the phase
    90   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
    93   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
    91 
    94 
    92   restart_with(non_taxable, tax);
    95   restart_with(non_taxable, tax);
    93 
    96 
    94   log_info(gc, ergo)("Pacer for Evacuation. Used CSet: " SIZE_FORMAT "M, Free: " SIZE_FORMAT
    97   log_info(gc, ergo)("Pacer for Evacuation. Used CSet: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, "
    95                      "M, Non-Taxable: " SIZE_FORMAT "M, Alloc Tax Rate: %.1fx",
    98                      "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx",
    96                      used / M, free / M, non_taxable / M, tax);
    99                      byte_size_in_proper_unit(used),        proper_unit_for_byte_size(used),
       
   100                      byte_size_in_proper_unit(free),        proper_unit_for_byte_size(free),
       
   101                      byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable),
       
   102                      tax);
    97 }
   103 }
    98 
   104 
    99 void ShenandoahPacer::setup_for_updaterefs() {
   105 void ShenandoahPacer::setup_for_updaterefs() {
   100   assert(ShenandoahPacing, "Only be here when pacing is enabled");
   106   assert(ShenandoahPacing, "Only be here when pacing is enabled");
   101 
   107 
   110   tax = MAX2<double>(1, tax);        // never allocate more than GC processes during the phase
   116   tax = MAX2<double>(1, tax);        // never allocate more than GC processes during the phase
   111   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
   117   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
   112 
   118 
   113   restart_with(non_taxable, tax);
   119   restart_with(non_taxable, tax);
   114 
   120 
   115   log_info(gc, ergo)("Pacer for Update Refs. Used: " SIZE_FORMAT "M, Free: " SIZE_FORMAT
   121   log_info(gc, ergo)("Pacer for Update Refs. Used: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, "
   116                      "M, Non-Taxable: " SIZE_FORMAT "M, Alloc Tax Rate: %.1fx",
   122                      "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx",
   117                      used / M, free / M, non_taxable / M, tax);
   123                      byte_size_in_proper_unit(used),        proper_unit_for_byte_size(used),
       
   124                      byte_size_in_proper_unit(free),        proper_unit_for_byte_size(free),
       
   125                      byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable),
       
   126                      tax);
   118 }
   127 }
   119 
   128 
   120 /*
   129 /*
   121  * Traversal walks the entire heap once, and therefore we have to make assumptions about its
   130  * Traversal walks the entire heap once, and therefore we have to make assumptions about its
   122  * liveness, like concurrent mark does.
   131  * liveness, like concurrent mark does.
   134   double tax = 1.0 * live / taxable; // base tax for available free space
   143   double tax = 1.0 * live / taxable; // base tax for available free space
   135   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
   144   tax *= ShenandoahPacingSurcharge;  // additional surcharge to help unclutter heap
   136 
   145 
   137   restart_with(non_taxable, tax);
   146   restart_with(non_taxable, tax);
   138 
   147 
   139   log_info(gc, ergo)("Pacer for Traversal. Expected Live: " SIZE_FORMAT "M, Free: " SIZE_FORMAT
   148   log_info(gc, ergo)("Pacer for Traversal. Expected Live: " SIZE_FORMAT "%s, Free: " SIZE_FORMAT "%s, "
   140                      "M, Non-Taxable: " SIZE_FORMAT "M, Alloc Tax Rate: %.1fx",
   149                      "Non-Taxable: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx",
   141                      live / M, free / M, non_taxable / M, tax);
   150                      byte_size_in_proper_unit(live),        proper_unit_for_byte_size(live),
       
   151                      byte_size_in_proper_unit(free),        proper_unit_for_byte_size(free),
       
   152                      byte_size_in_proper_unit(non_taxable), proper_unit_for_byte_size(non_taxable),
       
   153                      tax);
   142 }
   154 }
   143 
   155 
   144 /*
   156 /*
   145  * In idle phase, we have to pace the application to let control thread react with GC start.
   157  * In idle phase, we have to pace the application to let control thread react with GC start.
   146  *
   158  *
   156   size_t initial = _heap->max_capacity() / 100 * ShenandoahPacingIdleSlack;
   168   size_t initial = _heap->max_capacity() / 100 * ShenandoahPacingIdleSlack;
   157   double tax = 1;
   169   double tax = 1;
   158 
   170 
   159   restart_with(initial, tax);
   171   restart_with(initial, tax);
   160 
   172 
   161   log_info(gc, ergo)("Pacer for Idle. Initial: " SIZE_FORMAT "M, Alloc Tax Rate: %.1fx",
   173   log_info(gc, ergo)("Pacer for Idle. Initial: " SIZE_FORMAT "%s, Alloc Tax Rate: %.1fx",
   162                      initial / M, tax);
   174                      byte_size_in_proper_unit(initial), proper_unit_for_byte_size(initial),
       
   175                      tax);
   163 }
   176 }
   164 
   177 
   165 size_t ShenandoahPacer::update_and_get_progress_history() {
   178 size_t ShenandoahPacer::update_and_get_progress_history() {
   166   if (_progress == -1) {
   179   if (_progress == -1) {
   167     // First initialization, report some prior
   180     // First initialization, report some prior