< prev index next >

src/hotspot/share/gc/parallel/psScavenge.cpp

Print this page
rev 59215 : imported patch max_gen_size


 575       if (UseAdaptiveSizePolicy) {
 576         // Calculate the new survivor size and tenuring threshold
 577 
 578         log_debug(gc, ergo)("AdaptiveSizeStart:  collection: %d ", heap->total_collections());
 579         log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT,
 580                             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
 581 
 582         if (UsePerfData) {
 583           PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
 584           counters->update_old_eden_size(
 585             size_policy->calculated_eden_size_in_bytes());
 586           counters->update_old_promo_size(
 587             size_policy->calculated_promo_size_in_bytes());
 588           counters->update_old_capacity(old_gen->capacity_in_bytes());
 589           counters->update_young_capacity(young_gen->capacity_in_bytes());
 590           counters->update_survived(survived);
 591           counters->update_promoted(promoted);
 592           counters->update_survivor_overflowed(_survivor_overflow);
 593         }
 594 
 595         size_t max_young_size = young_gen->max_size();
 596 
 597         // Deciding a free ratio in the young generation is tricky, so if
 598         // MinHeapFreeRatio or MaxHeapFreeRatio are in use (implicating
 599         // that the old generation size may have been limited because of them) we
 600         // should then limit our young generation size using NewRatio to have it
 601         // follow the old generation size.
 602         if (MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) {
 603           max_young_size = MIN2(old_gen->capacity_in_bytes() / NewRatio, young_gen->max_size());

 604         }
 605 
 606         size_t survivor_limit =
 607           size_policy->max_survivor_size(max_young_size);
 608         _tenuring_threshold =
 609           size_policy->compute_survivor_space_size_and_threshold(
 610                                                            _survivor_overflow,
 611                                                            _tenuring_threshold,
 612                                                            survivor_limit);
 613 
 614        log_debug(gc, age)("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max threshold " UINTX_FORMAT ")",
 615                           size_policy->calculated_survivor_size_in_bytes(),
 616                           _tenuring_threshold, MaxTenuringThreshold);
 617 
 618         if (UsePerfData) {
 619           PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
 620           counters->update_tenuring_threshold(_tenuring_threshold);
 621           counters->update_survivor_size_counters();
 622         }
 623 
 624         // Do call at minor collections?
 625         // Don't check if the size_policy is ready at this
 626         // level.  Let the size_policy check that internally.
 627         if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
 628             (AdaptiveSizePolicy::should_update_eden_stats(gc_cause))) {
 629           // Calculate optimal free space amounts
 630           assert(young_gen->max_size() >
 631             young_gen->from_space()->capacity_in_bytes() +
 632             young_gen->to_space()->capacity_in_bytes(),
 633             "Sizes of space in young gen are out-of-bounds");
 634 
 635           size_t young_live = young_gen->used_in_bytes();
 636           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 637           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 638           size_t max_old_gen_size = old_gen->max_gen_size();
 639           size_t max_eden_size = max_young_size -
 640             young_gen->from_space()->capacity_in_bytes() -
 641             young_gen->to_space()->capacity_in_bytes();
 642 
 643           // Used for diagnostics
 644           size_policy->clear_generation_free_space_flags();
 645 
 646           size_policy->compute_eden_space_size(young_live,
 647                                                eden_live,
 648                                                cur_eden,
 649                                                max_eden_size,
 650                                                false /* not full gc*/);




 575       if (UseAdaptiveSizePolicy) {
 576         // Calculate the new survivor size and tenuring threshold
 577 
 578         log_debug(gc, ergo)("AdaptiveSizeStart:  collection: %d ", heap->total_collections());
 579         log_trace(gc, ergo)("old_gen_capacity: " SIZE_FORMAT " young_gen_capacity: " SIZE_FORMAT,
 580                             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
 581 
 582         if (UsePerfData) {
 583           PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
 584           counters->update_old_eden_size(
 585             size_policy->calculated_eden_size_in_bytes());
 586           counters->update_old_promo_size(
 587             size_policy->calculated_promo_size_in_bytes());
 588           counters->update_old_capacity(old_gen->capacity_in_bytes());
 589           counters->update_young_capacity(young_gen->capacity_in_bytes());
 590           counters->update_survived(survived);
 591           counters->update_promoted(promoted);
 592           counters->update_survivor_overflowed(_survivor_overflow);
 593         }
 594 
 595         size_t max_young_size = young_gen->max_gen_size();
 596 
 597         // Deciding a free ratio in the young generation is tricky, so if
 598         // MinHeapFreeRatio or MaxHeapFreeRatio are in use (implicating
 599         // that the old generation size may have been limited because of them) we
 600         // should then limit our young generation size using NewRatio to have it
 601         // follow the old generation size.
 602         if (MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) {
 603           max_young_size = MIN2(old_gen->capacity_in_bytes() / NewRatio,
 604                                 young_gen->max_gen_size());
 605         }
 606 
 607         size_t survivor_limit =
 608           size_policy->max_survivor_size(max_young_size);
 609         _tenuring_threshold =
 610           size_policy->compute_survivor_space_size_and_threshold(
 611                                                            _survivor_overflow,
 612                                                            _tenuring_threshold,
 613                                                            survivor_limit);
 614 
 615        log_debug(gc, age)("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max threshold " UINTX_FORMAT ")",
 616                           size_policy->calculated_survivor_size_in_bytes(),
 617                           _tenuring_threshold, MaxTenuringThreshold);
 618 
 619         if (UsePerfData) {
 620           PSGCAdaptivePolicyCounters* counters = heap->gc_policy_counters();
 621           counters->update_tenuring_threshold(_tenuring_threshold);
 622           counters->update_survivor_size_counters();
 623         }
 624 
 625         // Do call at minor collections?
 626         // Don't check if the size_policy is ready at this
 627         // level.  Let the size_policy check that internally.
 628         if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
 629             AdaptiveSizePolicy::should_update_eden_stats(gc_cause)) {
 630           // Calculate optimal free space amounts
 631           assert(young_gen->max_gen_size() >
 632                  young_gen->from_space()->capacity_in_bytes() +
 633                  young_gen->to_space()->capacity_in_bytes(),
 634                  "Sizes of space in young gen are out-of-bounds");
 635 
 636           size_t young_live = young_gen->used_in_bytes();
 637           size_t eden_live = young_gen->eden_space()->used_in_bytes();
 638           size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
 639           size_t max_old_gen_size = old_gen->max_gen_size();
 640           size_t max_eden_size = max_young_size -
 641             young_gen->from_space()->capacity_in_bytes() -
 642             young_gen->to_space()->capacity_in_bytes();
 643 
 644           // Used for diagnostics
 645           size_policy->clear_generation_free_space_flags();
 646 
 647           size_policy->compute_eden_space_size(young_live,
 648                                                eden_live,
 649                                                cur_eden,
 650                                                max_eden_size,
 651                                                false /* not full gc*/);


< prev index next >