--- old/src/share/vm/gc/g1/g1ConcurrentMark.cpp 2016-02-08 15:06:01.544847834 +0100 +++ new/src/share/vm/gc/g1/g1ConcurrentMark.cpp 2016-02-08 15:06:01.432847830 +0100 @@ -372,12 +372,16 @@ return res; } -void G1CMRootRegions::cancel_scan() { +void G1CMRootRegions::notify_scan_done() { MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag); _scan_in_progress = false; RootRegionScan_lock->notify_all(); } +void G1CMRootRegions::cancel_scan() { + notify_scan_done(); +} + void G1CMRootRegions::scan_finished() { assert(scan_in_progress(), "pre-condition"); @@ -387,11 +391,7 @@ } _next_survivor = NULL; - { - MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag); - _scan_in_progress = false; - RootRegionScan_lock->notify_all(); - } + notify_scan_done(); } bool G1CMRootRegions::wait_until_scan_finished() {