comparison src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp @ 17755:96b1c2e06e25

8027295: Free CSet takes ~50% of young pause time Summary: Improve fast card cache iteration and avoid taking locks when freeing the collection set. Reviewed-by: brutisso
author tschatzl
date Mon, 24 Mar 2014 15:30:36 +0100
parents 191174b49bec
children a07bea31ef35
comparison
equal deleted inserted replaced
17754:d7070f371770 17755:96b1c2e06e25
5973 COMPILER2_PRESENT(DerivedPointerTable::update_pointers()); 5973 COMPILER2_PRESENT(DerivedPointerTable::update_pointers());
5974 } 5974 }
5975 5975
5976 void G1CollectedHeap::free_region(HeapRegion* hr, 5976 void G1CollectedHeap::free_region(HeapRegion* hr,
5977 FreeRegionList* free_list, 5977 FreeRegionList* free_list,
5978 bool par) { 5978 bool par,
5979 bool locked) {
5979 assert(!hr->isHumongous(), "this is only for non-humongous regions"); 5980 assert(!hr->isHumongous(), "this is only for non-humongous regions");
5980 assert(!hr->is_empty(), "the region should not be empty"); 5981 assert(!hr->is_empty(), "the region should not be empty");
5981 assert(free_list != NULL, "pre-condition"); 5982 assert(free_list != NULL, "pre-condition");
5982 5983
5983 // Clear the card counts for this region. 5984 // Clear the card counts for this region.
5984 // Note: we only need to do this if the region is not young 5985 // Note: we only need to do this if the region is not young
5985 // (since we don't refine cards in young regions). 5986 // (since we don't refine cards in young regions).
5986 if (!hr->is_young()) { 5987 if (!hr->is_young()) {
5987 _cg1r->hot_card_cache()->reset_card_counts(hr); 5988 _cg1r->hot_card_cache()->reset_card_counts(hr);
5988 } 5989 }
5989 hr->hr_clear(par, true /* clear_space */); 5990 hr->hr_clear(par, true /* clear_space */, locked /* locked */);
5990 free_list->add_as_head(hr); 5991 free_list->add_as_head(hr);
5991 } 5992 }
5992 5993
5993 void G1CollectedHeap::free_humongous_region(HeapRegion* hr, 5994 void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
5994 FreeRegionList* free_list, 5995 FreeRegionList* free_list,
6193 start_sec = os::elapsedTime(); 6194 start_sec = os::elapsedTime();
6194 non_young = true; 6195 non_young = true;
6195 } 6196 }
6196 } 6197 }
6197 6198
6198 rs_lengths += cur->rem_set()->occupied(); 6199 rs_lengths += cur->rem_set()->occupied_locked();
6199 6200
6200 HeapRegion* next = cur->next_in_collection_set(); 6201 HeapRegion* next = cur->next_in_collection_set();
6201 assert(cur->in_collection_set(), "bad CS"); 6202 assert(cur->in_collection_set(), "bad CS");
6202 cur->set_next_in_collection_set(NULL); 6203 cur->set_next_in_collection_set(NULL);
6203 cur->set_in_collection_set(false); 6204 cur->set_in_collection_set(false);
6227 MemRegion used_mr = cur->used_region(); 6228 MemRegion used_mr = cur->used_region();
6228 6229
6229 // And the region is empty. 6230 // And the region is empty.
6230 assert(!used_mr.is_empty(), "Should not have empty regions in a CS."); 6231 assert(!used_mr.is_empty(), "Should not have empty regions in a CS.");
6231 pre_used += cur->used(); 6232 pre_used += cur->used();
6232 free_region(cur, &local_free_list, false /* par */); 6233 free_region(cur, &local_free_list, false /* par */, true /* locked */);
6233 } else { 6234 } else {
6234 cur->uninstall_surv_rate_group(); 6235 cur->uninstall_surv_rate_group();
6235 if (cur->is_young()) { 6236 if (cur->is_young()) {
6236 cur->set_young_index_in_cset(-1); 6237 cur->set_young_index_in_cset(-1);
6237 } 6238 }