1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Jan 20 18:01:32 2012 +0100 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Jan 23 20:36:16 2012 +0100 1.3 @@ -1138,36 +1138,41 @@ 1.4 return ret; 1.5 } 1.6 1.7 -bool G1CollectorPolicy::need_to_start_conc_mark(const char* source) { 1.8 - if (_g1->mark_in_progress()) { 1.9 +bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) { 1.10 + if (_g1->concurrent_mark()->cmThread()->during_cycle()) { 1.11 return false; 1.12 } 1.13 1.14 size_t marking_initiating_used_threshold = 1.15 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; 1.16 size_t cur_used_bytes = _g1->non_young_capacity_bytes(); 1.17 - 1.18 - if (cur_used_bytes > marking_initiating_used_threshold) { 1.19 + size_t alloc_byte_size = alloc_word_size * HeapWordSize; 1.20 + 1.21 + if ((cur_used_bytes + alloc_byte_size) > marking_initiating_used_threshold) { 1.22 if (gcs_are_young()) { 1.23 - ergo_verbose4(ErgoConcCycles, 1.24 + ergo_verbose5(ErgoConcCycles, 1.25 "request concurrent cycle initiation", 1.26 ergo_format_reason("occupancy higher than threshold") 1.27 ergo_format_byte("occupancy") 1.28 + ergo_format_byte("allocation request") 1.29 ergo_format_byte_perc("threshold") 1.30 ergo_format_str("source"), 1.31 cur_used_bytes, 1.32 + alloc_byte_size, 1.33 marking_initiating_used_threshold, 1.34 (double) InitiatingHeapOccupancyPercent, 1.35 source); 1.36 return true; 1.37 } else { 1.38 - ergo_verbose4(ErgoConcCycles, 1.39 + ergo_verbose5(ErgoConcCycles, 1.40 "do not request concurrent cycle initiation", 1.41 ergo_format_reason("still doing mixed collections") 1.42 ergo_format_byte("occupancy") 1.43 + ergo_format_byte("allocation request") 1.44 ergo_format_byte_perc("threshold") 1.45 ergo_format_str("source"), 1.46 cur_used_bytes, 1.47 + alloc_byte_size, 1.48 marking_initiating_used_threshold, 1.49 (double) InitiatingHeapOccupancyPercent, 1.50 source);