src/share/vm/gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.cpp

Print this page




 952   size_t delta = eden_decrement(cur_eden);
 953   return align_size_down(delta, generation_alignment());
 954 }
 955 
 956 size_t CMSAdaptiveSizePolicy::eden_increment_aligned_up(size_t cur_eden) {
 957   size_t delta = eden_increment(cur_eden);
 958   return align_size_up(delta, generation_alignment());
 959 }
 960 
 961 size_t CMSAdaptiveSizePolicy::promo_decrement_aligned_down(size_t cur_promo) {
 962   size_t delta = promo_decrement(cur_promo);
 963   return align_size_down(delta, generation_alignment());
 964 }
 965 
 966 size_t CMSAdaptiveSizePolicy::promo_increment_aligned_up(size_t cur_promo) {
 967   size_t delta = promo_increment(cur_promo);
 968   return align_size_up(delta, generation_alignment());
 969 }
 970 
 971 
 972 void CMSAdaptiveSizePolicy::compute_young_generation_free_space(size_t cur_eden,
 973                                           size_t max_eden_size)
 974 {
 975   size_t desired_eden_size = cur_eden;
 976   size_t eden_limit = max_eden_size;
 977 
 978   // Printout input
 979   if (PrintGC && PrintAdaptiveSizePolicy) {
 980     gclog_or_tty->print_cr(
 981       "CMSAdaptiveSizePolicy::compute_young_generation_free_space: "
 982       "cur_eden " SIZE_FORMAT,
 983       cur_eden);
 984   }
 985 
 986   // Used for diagnostics
 987   clear_generation_free_space_flags();
 988 
 989   if (_avg_minor_pause->padded_average() > gc_pause_goal_sec()) {
 990     if (minor_pause_young_estimator()->decrement_will_decrease()) {
 991       // If the minor pause is too long, shrink the young gen.
 992       set_change_young_gen_for_min_pauses(
 993         decrease_young_gen_for_min_pauses_true);
 994       desired_eden_size = adjust_eden_for_pause_time(desired_eden_size);
 995     }
 996   } else if ((avg_remark_pause()->padded_average() > gc_pause_goal_sec()) ||
 997              (avg_initial_pause()->padded_average() > gc_pause_goal_sec())) {
 998     // The remark or initial pauses are not meeting the goal.  Should
 999     // the generation be shrunk?
1000     if (get_and_clear_first_after_collection() &&
1001         ((avg_remark_pause()->padded_average() > gc_pause_goal_sec() &&


1007          decrease_young_gen_for_maj_pauses_true);
1008 
1009       // If the remark or initial pause is too long and this is the
1010       // first young gen collection after a cms collection, shrink
1011       // the young gen.
1012       desired_eden_size = adjust_eden_for_pause_time(desired_eden_size);
1013     }
1014     // If not the first young gen collection after a cms collection,
1015     // don't do anything.  In this case an adjustment has already
1016     // been made and the results of the adjustment has not yet been
1017     // measured.
1018   } else if ((minor_gc_cost() >= 0.0) &&
1019              (adjusted_mutator_cost() < _throughput_goal)) {
1020     desired_eden_size = adjust_eden_for_throughput(desired_eden_size);
1021   } else {
1022     desired_eden_size = adjust_eden_for_footprint(desired_eden_size);
1023   }
1024 
1025   if (PrintGC && PrintAdaptiveSizePolicy) {
1026     gclog_or_tty->print_cr(
1027       "CMSAdaptiveSizePolicy::compute_young_generation_free_space limits:"
1028       " desired_eden_size: " SIZE_FORMAT
1029       " old_eden_size: " SIZE_FORMAT,
1030       desired_eden_size, cur_eden);
1031   }
1032 
1033   set_eden_size(desired_eden_size);
1034 }
1035 
1036 size_t CMSAdaptiveSizePolicy::adjust_promo_for_pause_time(size_t cur_promo) {
1037   size_t change = 0;
1038   size_t desired_promo = cur_promo;
1039   // Move this test up to caller like the adjust_eden_for_pause_time()
1040   // call.
1041   if ((AdaptiveSizePausePolicy == 0) &&
1042       ((avg_remark_pause()->padded_average() > gc_pause_goal_sec()) ||
1043       (avg_initial_pause()->padded_average() > gc_pause_goal_sec()))) {
1044     set_change_old_gen_for_maj_pauses(decrease_old_gen_for_maj_pauses_true);
1045     change = promo_decrement_aligned_down(cur_promo);
1046     desired_promo = cur_promo - change;
1047   } else if ((AdaptiveSizePausePolicy > 0) &&




 952   size_t delta = eden_decrement(cur_eden);
 953   return align_size_down(delta, generation_alignment());
 954 }
 955 
 956 size_t CMSAdaptiveSizePolicy::eden_increment_aligned_up(size_t cur_eden) {
 957   size_t delta = eden_increment(cur_eden);
 958   return align_size_up(delta, generation_alignment());
 959 }
 960 
 961 size_t CMSAdaptiveSizePolicy::promo_decrement_aligned_down(size_t cur_promo) {
 962   size_t delta = promo_decrement(cur_promo);
 963   return align_size_down(delta, generation_alignment());
 964 }
 965 
 966 size_t CMSAdaptiveSizePolicy::promo_increment_aligned_up(size_t cur_promo) {
 967   size_t delta = promo_increment(cur_promo);
 968   return align_size_up(delta, generation_alignment());
 969 }
 970 
 971 
 972 void CMSAdaptiveSizePolicy::compute_eden_space_size(size_t cur_eden,
 973                                           size_t max_eden_size)
 974 {
 975   size_t desired_eden_size = cur_eden;
 976   size_t eden_limit = max_eden_size;
 977 
 978   // Printout input
 979   if (PrintGC && PrintAdaptiveSizePolicy) {
 980     gclog_or_tty->print_cr(
 981       "CMSAdaptiveSizePolicy::compute_eden_space_size: "
 982       "cur_eden " SIZE_FORMAT,
 983       cur_eden);
 984   }
 985 
 986   // Used for diagnostics
 987   clear_generation_free_space_flags();
 988 
 989   if (_avg_minor_pause->padded_average() > gc_pause_goal_sec()) {
 990     if (minor_pause_young_estimator()->decrement_will_decrease()) {
 991       // If the minor pause is too long, shrink the young gen.
 992       set_change_young_gen_for_min_pauses(
 993         decrease_young_gen_for_min_pauses_true);
 994       desired_eden_size = adjust_eden_for_pause_time(desired_eden_size);
 995     }
 996   } else if ((avg_remark_pause()->padded_average() > gc_pause_goal_sec()) ||
 997              (avg_initial_pause()->padded_average() > gc_pause_goal_sec())) {
 998     // The remark or initial pauses are not meeting the goal.  Should
 999     // the generation be shrunk?
1000     if (get_and_clear_first_after_collection() &&
1001         ((avg_remark_pause()->padded_average() > gc_pause_goal_sec() &&


1007          decrease_young_gen_for_maj_pauses_true);
1008 
1009       // If the remark or initial pause is too long and this is the
1010       // first young gen collection after a cms collection, shrink
1011       // the young gen.
1012       desired_eden_size = adjust_eden_for_pause_time(desired_eden_size);
1013     }
1014     // If not the first young gen collection after a cms collection,
1015     // don't do anything.  In this case an adjustment has already
1016     // been made and the results of the adjustment has not yet been
1017     // measured.
1018   } else if ((minor_gc_cost() >= 0.0) &&
1019              (adjusted_mutator_cost() < _throughput_goal)) {
1020     desired_eden_size = adjust_eden_for_throughput(desired_eden_size);
1021   } else {
1022     desired_eden_size = adjust_eden_for_footprint(desired_eden_size);
1023   }
1024 
1025   if (PrintGC && PrintAdaptiveSizePolicy) {
1026     gclog_or_tty->print_cr(
1027       "CMSAdaptiveSizePolicy::compute_eden_space_size limits:"
1028       " desired_eden_size: " SIZE_FORMAT
1029       " old_eden_size: " SIZE_FORMAT,
1030       desired_eden_size, cur_eden);
1031   }
1032 
1033   set_eden_size(desired_eden_size);
1034 }
1035 
1036 size_t CMSAdaptiveSizePolicy::adjust_promo_for_pause_time(size_t cur_promo) {
1037   size_t change = 0;
1038   size_t desired_promo = cur_promo;
1039   // Move this test up to caller like the adjust_eden_for_pause_time()
1040   // call.
1041   if ((AdaptiveSizePausePolicy == 0) &&
1042       ((avg_remark_pause()->padded_average() > gc_pause_goal_sec()) ||
1043       (avg_initial_pause()->padded_average() > gc_pause_goal_sec()))) {
1044     set_change_old_gen_for_maj_pauses(decrease_old_gen_for_maj_pauses_true);
1045     change = promo_decrement_aligned_down(cur_promo);
1046     desired_promo = cur_promo - change;
1047   } else if ((AdaptiveSizePausePolicy > 0) &&