comparison src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp @ 17648:a034dc5e910b

8028391: Make the Min/MaxHeapFreeRatio flags manageable Summary: Made the flags Min- and MaxHeapFreeRatio manageable, and implemented support for these flags in ParallelGC. Reviewed-by: sla, mgerdin, brutisso
author jwilhelm
date Wed, 29 Jan 2014 23:17:05 +0100
parents 04f1d5d36714
children 78bbf4d43a14
comparison
equal deleted inserted replaced
17647:3d60c34b14ca 17648:a034dc5e910b
527 counters->update_survived(survived); 527 counters->update_survived(survived);
528 counters->update_promoted(promoted); 528 counters->update_promoted(promoted);
529 counters->update_survivor_overflowed(_survivor_overflow); 529 counters->update_survivor_overflowed(_survivor_overflow);
530 } 530 }
531 531
532 size_t max_young_size = young_gen->max_size();
533
534 // Deciding a free ratio in the young generation is tricky, so if
535 // MinHeapFreeRatio or MaxHeapFreeRatio are in use (implicating
536 // that the old generation size may have been limited because of them) we
537 // should then limit our young generation size using NewRatio to have it
538 // follow the old generation size.
539 if (MinHeapFreeRatio != 0 || MaxHeapFreeRatio != 100) {
540 max_young_size = MIN2(old_gen->capacity_in_bytes() / NewRatio, young_gen->max_size());
541 }
542
532 size_t survivor_limit = 543 size_t survivor_limit =
533 size_policy->max_survivor_size(young_gen->max_size()); 544 size_policy->max_survivor_size(max_young_size);
534 _tenuring_threshold = 545 _tenuring_threshold =
535 size_policy->compute_survivor_space_size_and_threshold( 546 size_policy->compute_survivor_space_size_and_threshold(
536 _survivor_overflow, 547 _survivor_overflow,
537 _tenuring_threshold, 548 _tenuring_threshold,
538 survivor_limit); 549 survivor_limit);
551 } 562 }
552 563
553 // Do call at minor collections? 564 // Do call at minor collections?
554 // Don't check if the size_policy is ready at this 565 // Don't check if the size_policy is ready at this
555 // level. Let the size_policy check that internally. 566 // level. Let the size_policy check that internally.
556 if (UseAdaptiveSizePolicy && 567 if (UseAdaptiveGenerationSizePolicyAtMinorCollection &&
557 UseAdaptiveGenerationSizePolicyAtMinorCollection &&
558 ((gc_cause != GCCause::_java_lang_system_gc) || 568 ((gc_cause != GCCause::_java_lang_system_gc) ||
559 UseAdaptiveSizePolicyWithSystemGC)) { 569 UseAdaptiveSizePolicyWithSystemGC)) {
560 570
561 // Calculate optimial free space amounts 571 // Calculate optimial free space amounts
562 assert(young_gen->max_size() > 572 assert(young_gen->max_size() >
566 576
567 size_t young_live = young_gen->used_in_bytes(); 577 size_t young_live = young_gen->used_in_bytes();
568 size_t eden_live = young_gen->eden_space()->used_in_bytes(); 578 size_t eden_live = young_gen->eden_space()->used_in_bytes();
569 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes(); 579 size_t cur_eden = young_gen->eden_space()->capacity_in_bytes();
570 size_t max_old_gen_size = old_gen->max_gen_size(); 580 size_t max_old_gen_size = old_gen->max_gen_size();
571 size_t max_eden_size = young_gen->max_size() - 581 size_t max_eden_size = max_young_size -
572 young_gen->from_space()->capacity_in_bytes() - 582 young_gen->from_space()->capacity_in_bytes() -
573 young_gen->to_space()->capacity_in_bytes(); 583 young_gen->to_space()->capacity_in_bytes();
574 584
575 // Used for diagnostics 585 // Used for diagnostics
576 size_policy->clear_generation_free_space_flags(); 586 size_policy->clear_generation_free_space_flags();