1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue May 03 10:30:34 2011 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue May 17 00:56:01 2011 -0700 1.3 @@ -3323,8 +3323,9 @@ 1.4 // progress, this will be zero. 1.5 _cm->set_oops_do_bound(); 1.6 1.7 - if (mark_in_progress()) 1.8 + if (mark_in_progress()) { 1.9 concurrent_mark()->newCSet(); 1.10 + } 1.11 1.12 #if YOUNG_LIST_VERBOSE 1.13 gclog_or_tty->print_cr("\nBefore choosing collection set.\nYoung_list:"); 1.14 @@ -3334,6 +3335,16 @@ 1.15 1.16 g1_policy()->choose_collection_set(target_pause_time_ms); 1.17 1.18 + // We have chosen the complete collection set. If marking is 1.19 + // active then, we clear the region fields of any of the 1.20 + // concurrent marking tasks whose region fields point into 1.21 + // the collection set as these values will become stale. This 1.22 + // will cause the owning marking threads to claim a new region 1.23 + // when marking restarts. 1.24 + if (mark_in_progress()) { 1.25 + concurrent_mark()->reset_active_task_region_fields_in_cset(); 1.26 + } 1.27 + 1.28 // Nothing to do if we were unable to choose a collection set. 1.29 #if G1_REM_SET_LOGGING 1.30 gclog_or_tty->print_cr("\nAfter pause, heap:");