comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 4912:a9647476d1a4

7132029: G1: mixed GC phase lasts for longer than it should Summary: Revamp of the mechanism that chooses old regions for inclusion in the CSet. It simplifies the code and introduces min and max bounds on the number of old regions added to the CSet at each mixed GC to avoid pathological cases. It also ensures that when we do a mixed GC we'll always find old regions to add to the CSet (i.e., it eliminates the case where a mixed GC will collect no old regions which can happen today). Reviewed-by: johnc, brutisso
author tonyp
date Wed, 15 Feb 2012 13:06:53 -0500
parents caa4652b4414
children 64bf7c8270cb
comparison
equal deleted inserted replaced
4911:d903bf750e9f 4912:a9647476d1a4
3445 _cmThread->set_started(); 3445 _cmThread->set_started();
3446 CGC_lock->notify(); 3446 CGC_lock->notify();
3447 } 3447 }
3448 } 3448 }
3449 3449
3450 double G1CollectedHeap::predict_region_elapsed_time_ms(HeapRegion *hr,
3451 bool young) {
3452 return _g1_policy->predict_region_elapsed_time_ms(hr, young);
3453 }
3454
3455 void G1CollectedHeap::check_if_region_is_too_expensive(double
3456 predicted_time_ms) {
3457 _g1_policy->check_if_region_is_too_expensive(predicted_time_ms);
3458 }
3459
3460 size_t G1CollectedHeap::pending_card_num() { 3450 size_t G1CollectedHeap::pending_card_num() {
3461 size_t extra_cards = 0; 3451 size_t extra_cards = 0;
3462 JavaThread *curr = Threads::first(); 3452 JavaThread *curr = Threads::first();
3463 while (curr != NULL) { 3453 while (curr != NULL) {
3464 DirtyCardQueue& dcq = curr->dirty_card_queue(); 3454 DirtyCardQueue& dcq = curr->dirty_card_queue();
3726 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:"); 3716 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:");
3727 _young_list->print(); 3717 _young_list->print();
3728 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty); 3718 g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
3729 #endif // YOUNG_LIST_VERBOSE 3719 #endif // YOUNG_LIST_VERBOSE
3730 3720
3731 g1_policy()->choose_collection_set(target_pause_time_ms); 3721 g1_policy()->finalize_cset(target_pause_time_ms);
3732 3722
3733 _cm->note_start_of_gc(); 3723 _cm->note_start_of_gc();
3734 // We should not verify the per-thread SATB buffers given that 3724 // We should not verify the per-thread SATB buffers given that
3735 // we have not filtered them yet (we'll do so during the 3725 // we have not filtered them yet (we'll do so during the
3736 // GC). We also call this after choose_collection_set() to 3726 // GC). We also call this after finalize_cset() to
3737 // ensure that the CSet has been finalized. 3727 // ensure that the CSet has been finalized.
3738 _cm->verify_no_cset_oops(true /* verify_stacks */, 3728 _cm->verify_no_cset_oops(true /* verify_stacks */,
3739 true /* verify_enqueued_buffers */, 3729 true /* verify_enqueued_buffers */,
3740 false /* verify_thread_buffers */, 3730 false /* verify_thread_buffers */,
3741 true /* verify_fingers */); 3731 true /* verify_fingers */);