src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp

Print this page




 119   julong _young_gen_change_for_major_pause_count;
 120 
 121   // To facilitate faster growth at start up, supplement the normal
 122   // growth percentage for the young gen eden and the
 123   // old gen space for promotion with these value which decay
 124   // with increasing collections.
 125   uint _young_gen_size_increment_supplement;
 126   uint _old_gen_size_increment_supplement;
 127 
 128   // The number of bytes absorbed from eden into the old gen by moving the
 129   // boundary over live data.
 130   size_t _bytes_absorbed_from_eden;
 131 
 132  private:
 133 
 134   // Accessors
 135   AdaptivePaddedAverage* avg_major_pause() const { return _avg_major_pause; }
 136   double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
 137 
 138   // Change the young generation size to achieve a minor GC pause time goal
 139   void adjust_for_minor_pause_time(bool is_full_gc,
 140                                    size_t* desired_promo_size_ptr,
 141                                    size_t* desired_eden_size_ptr);


 142   // Change the generation sizes to achieve a GC pause time goal
 143   // Returned sizes are not necessarily aligned.
 144   void adjust_for_pause_time(bool is_full_gc,



 145                          size_t* desired_promo_size_ptr,
 146                          size_t* desired_eden_size_ptr);
 147   // Change the generation sizes to achieve an application throughput goal
 148   // Returned sizes are not necessarily aligned.
 149   void adjust_for_throughput(bool is_full_gc,
 150                              size_t* desired_promo_size_ptr,

 151                              size_t* desired_eden_size_ptr);
 152   // Change the generation sizes to achieve minimum footprint
 153   // Returned sizes are not aligned.
 154   size_t adjust_promo_for_footprint(size_t desired_promo_size,
 155                                     size_t desired_total);
 156   size_t adjust_eden_for_footprint(size_t desired_promo_size,
 157                                    size_t desired_total);
 158 
 159   // Size in bytes for an increment or decrement of eden.
 160   virtual size_t eden_increment(size_t cur_eden, uint percent_change);
 161   virtual size_t eden_decrement(size_t cur_eden);
 162   size_t eden_decrement_aligned_down(size_t cur_eden);
 163   size_t eden_increment_with_supplement_aligned_up(size_t cur_eden);
 164 
 165   // Size in bytes for an increment or decrement of the promotion area
 166   virtual size_t promo_increment(size_t cur_promo, uint percent_change);
 167   virtual size_t promo_decrement(size_t cur_promo);
 168   size_t promo_decrement_aligned_down(size_t cur_promo);
 169   size_t promo_increment_with_supplement_aligned_up(size_t cur_promo);
 170 
 171   // Decay the supplemental growth additive.
 172   void decay_supplemental_growth(bool is_full_gc);
 173 
 174   // Returns a change that has been scaled down.  Result
 175   // is not aligned.  (If useful, move to some shared
 176   // location.)
 177   size_t scale_down(size_t change, double part, double total);
 178 
 179  protected:
 180   // Time accessors
 181 
 182   // Footprint accessors
 183   size_t live_space() const {
 184     return (size_t)(avg_base_footprint()->average() +
 185                     avg_young_live()->average() +
 186                     avg_old_live()->average());
 187   }
 188   size_t free_space() const {
 189     return _eden_size + _promo_size;
 190   }
 191 
 192   void set_promo_size(size_t new_size) {
 193     _promo_size = new_size;


 319 
 320   LinearLeastSquareFit* major_pause_young_estimator() {
 321     return _major_pause_young_estimator;
 322   }
 323 
 324 
 325   virtual void clear_generation_free_space_flags();
 326 
 327   float major_pause_old_slope() { return _major_pause_old_estimator->slope(); }
 328   float major_pause_young_slope() {
 329     return _major_pause_young_estimator->slope();
 330   }
 331   float major_collection_slope() { return _major_collection_estimator->slope();}
 332 
 333   bool old_gen_policy_is_ready() { return _old_gen_policy_is_ready; }
 334 
 335   // Given the amount of live data in the heap, should we
 336   // perform a Full GC?
 337   bool should_full_GC(size_t live_in_old_gen);
 338 
 339   // Calculates optimial free space sizes for both the old and young
 340   // generations.  Stores results in _eden_size and _promo_size.
 341   // Takes current used space in all generations as input, as well
 342   // as an indication if a full gc has just been performed, for use
 343   // in deciding if an OOM error should be thrown.
 344   void compute_generation_free_space(size_t young_live,
 345                                      size_t eden_live,
 346                                      size_t old_live,
 347                                      size_t cur_eden,  // current eden in bytes
 348                                      size_t max_old_gen_size,
 349                                      size_t max_eden_size,
 350                                      bool   is_full_gc,
 351                                      GCCause::Cause gc_cause,
 352                                      CollectorPolicy* collector_policy);









 353 
 354   // Calculates new survivor space size;  returns a new tenuring threshold
 355   // value. Stores new survivor size in _survivor_size.
 356   uint compute_survivor_space_size_and_threshold(bool   is_survivor_overflow,
 357                                                  uint    tenuring_threshold,
 358                                                  size_t survivor_limit);
 359 
 360   // Return the maximum size of a survivor space if the young generation were of
 361   // size gen_size.
 362   size_t max_survivor_size(size_t gen_size) {
 363     // Never allow the target survivor size to grow more than MinSurvivorRatio
 364     // of the young generation size.  We cannot grow into a two semi-space
 365     // system, with Eden zero sized.  Even if the survivor space grows, from()
 366     // might grow by moving the bottom boundary "down" -- so from space will
 367     // remain almost full anyway (top() will be near end(), but there will be a
 368     // large filler object at the bottom).
 369     const size_t sz = gen_size / MinSurvivorRatio;
 370     const size_t alignment = _intra_generation_alignment;
 371     return sz > alignment ? align_size_down(sz, alignment) : alignment;
 372   }
 373 
 374   size_t live_at_last_full_gc() {
 375     return _live_at_last_full_gc;
 376   }
 377 
 378   size_t bytes_absorbed_from_eden() const { return _bytes_absorbed_from_eden; }
 379   void   reset_bytes_absorbed_from_eden() { _bytes_absorbed_from_eden = 0; }
 380 
 381   void set_bytes_absorbed_from_eden(size_t val) {
 382     _bytes_absorbed_from_eden = val;
 383   }
 384 
 385   // Update averages that are always used (even
 386   // if adaptive sizing is turned off).
 387   void update_averages(bool is_survivor_overflow,
 388                        size_t survived,
 389                        size_t promoted);
 390 
 391   // Printing support
 392   virtual bool print_adaptive_size_policy_on(outputStream* st) const;



 393 };
 394 
 395 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP


 119   julong _young_gen_change_for_major_pause_count;
 120 
 121   // To facilitate faster growth at start up, supplement the normal
 122   // growth percentage for the young gen eden and the
 123   // old gen space for promotion with these value which decay
 124   // with increasing collections.
 125   uint _young_gen_size_increment_supplement;
 126   uint _old_gen_size_increment_supplement;
 127 
 128   // The number of bytes absorbed from eden into the old gen by moving the
 129   // boundary over live data.
 130   size_t _bytes_absorbed_from_eden;
 131 
 132  private:
 133 
 134   // Accessors
 135   AdaptivePaddedAverage* avg_major_pause() const { return _avg_major_pause; }
 136   double gc_minor_pause_goal_sec() const { return _gc_minor_pause_goal_sec; }
 137 
 138   // Change the young generation size to achieve a minor GC pause time goal
 139   void adjust_promo_for_minor_pause_time(bool is_full_gc,
 140                                    size_t* desired_promo_size_ptr,
 141                                    size_t* desired_eden_size_ptr);
 142   void adjust_eden_for_minor_pause_time(bool is_full_gc,
 143                                    size_t* desired_eden_size_ptr);
 144   // Change the generation sizes to achieve a GC pause time goal
 145   // Returned sizes are not necessarily aligned.
 146   void adjust_promo_for_pause_time(bool is_full_gc,
 147                          size_t* desired_promo_size_ptr,
 148                          size_t* desired_eden_size_ptr);
 149   void adjust_eden_for_pause_time(bool is_full_gc,
 150                          size_t* desired_promo_size_ptr,
 151                          size_t* desired_eden_size_ptr);
 152   // Change the generation sizes to achieve an application throughput goal
 153   // Returned sizes are not necessarily aligned.
 154   void adjust_promo_for_throughput(bool is_full_gc,
 155                              size_t* desired_promo_size_ptr);
 156   void adjust_eden_for_throughput(bool is_full_gc,
 157                              size_t* desired_eden_size_ptr);
 158   // Change the generation sizes to achieve minimum footprint
 159   // Returned sizes are not aligned.
 160   size_t adjust_promo_for_footprint(size_t desired_promo_size,
 161                                     size_t desired_total);
 162   size_t adjust_eden_for_footprint(size_t desired_promo_size,
 163                                    size_t desired_total);
 164 
 165   // Size in bytes for an increment or decrement of eden.
 166   virtual size_t eden_increment(size_t cur_eden, uint percent_change);
 167   virtual size_t eden_decrement(size_t cur_eden);
 168   size_t eden_decrement_aligned_down(size_t cur_eden);
 169   size_t eden_increment_with_supplement_aligned_up(size_t cur_eden);
 170 
 171   // Size in bytes for an increment or decrement of the promotion area
 172   virtual size_t promo_increment(size_t cur_promo, uint percent_change);
 173   virtual size_t promo_decrement(size_t cur_promo);
 174   size_t promo_decrement_aligned_down(size_t cur_promo);
 175   size_t promo_increment_with_supplement_aligned_up(size_t cur_promo);
 176 



 177   // Returns a change that has been scaled down.  Result
 178   // is not aligned.  (If useful, move to some shared
 179   // location.)
 180   size_t scale_down(size_t change, double part, double total);
 181 
 182  protected:
 183   // Time accessors
 184 
 185   // Footprint accessors
 186   size_t live_space() const {
 187     return (size_t)(avg_base_footprint()->average() +
 188                     avg_young_live()->average() +
 189                     avg_old_live()->average());
 190   }
 191   size_t free_space() const {
 192     return _eden_size + _promo_size;
 193   }
 194 
 195   void set_promo_size(size_t new_size) {
 196     _promo_size = new_size;


 322 
 323   LinearLeastSquareFit* major_pause_young_estimator() {
 324     return _major_pause_young_estimator;
 325   }
 326 
 327 
 328   virtual void clear_generation_free_space_flags();
 329 
 330   float major_pause_old_slope() { return _major_pause_old_estimator->slope(); }
 331   float major_pause_young_slope() {
 332     return _major_pause_young_estimator->slope();
 333   }
 334   float major_collection_slope() { return _major_collection_estimator->slope();}
 335 
 336   bool old_gen_policy_is_ready() { return _old_gen_policy_is_ready; }
 337 
 338   // Given the amount of live data in the heap, should we
 339   // perform a Full GC?
 340   bool should_full_GC(size_t live_in_old_gen);
 341 
 342   // Calculates optimal (free) space sizes for both the young and old
 343   // generations.  Stores results in _eden_size and _promo_size.
 344   // Takes current used space in all generations as input, as well
 345   // as an indication if a full gc has just been performed, for use
 346   // in deciding if an OOM error should be thrown.
 347   void compute_generation_free_space(size_t young_live,
 348                                      size_t eden_live,
 349                                      size_t old_live,
 350                                      size_t cur_eden,  // current eden in bytes
 351                                      size_t max_old_gen_size,
 352                                      size_t max_eden_size,
 353                                      bool   is_full_gc);
 354 
 355   void compute_eden_space_size(size_t young_live,
 356                                size_t eden_live,
 357                                size_t cur_eden,  // current eden in bytes
 358                                size_t max_eden_size,
 359                                bool   is_full_gc);
 360 
 361   void compute_old_gen_free_space(size_t old_live,
 362                                              size_t cur_eden,  // current eden in bytes
 363                                              size_t max_old_gen_size,
 364                                              bool   is_full_gc);
 365 
 366   // Calculates new survivor space size;  returns a new tenuring threshold
 367   // value. Stores new survivor size in _survivor_size.
 368   uint compute_survivor_space_size_and_threshold(bool   is_survivor_overflow,
 369                                                  uint    tenuring_threshold,
 370                                                  size_t survivor_limit);
 371 
 372   // Return the maximum size of a survivor space if the young generation were of
 373   // size gen_size.
 374   size_t max_survivor_size(size_t gen_size) {
 375     // Never allow the target survivor size to grow more than MinSurvivorRatio
 376     // of the young generation size.  We cannot grow into a two semi-space
 377     // system, with Eden zero sized.  Even if the survivor space grows, from()
 378     // might grow by moving the bottom boundary "down" -- so from space will
 379     // remain almost full anyway (top() will be near end(), but there will be a
 380     // large filler object at the bottom).
 381     const size_t sz = gen_size / MinSurvivorRatio;
 382     const size_t alignment = _intra_generation_alignment;
 383     return sz > alignment ? align_size_down(sz, alignment) : alignment;
 384   }
 385 
 386   size_t live_at_last_full_gc() {
 387     return _live_at_last_full_gc;
 388   }
 389 
 390   size_t bytes_absorbed_from_eden() const { return _bytes_absorbed_from_eden; }
 391   void   reset_bytes_absorbed_from_eden() { _bytes_absorbed_from_eden = 0; }
 392 
 393   void set_bytes_absorbed_from_eden(size_t val) {
 394     _bytes_absorbed_from_eden = val;
 395   }
 396 
 397   // Update averages that are always used (even
 398   // if adaptive sizing is turned off).
 399   void update_averages(bool is_survivor_overflow,
 400                        size_t survived,
 401                        size_t promoted);
 402 
 403   // Printing support
 404   virtual bool print_adaptive_size_policy_on(outputStream* st) const;
 405 
 406   // Decay the supplemental growth additive.
 407   void decay_supplemental_growth(bool is_full_gc);
 408 };
 409 
 410 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSADAPTIVESIZEPOLICY_HPP