RFR: JDK-8151336: Root region scanning should be cancelled and disabled when the ConcurrentMarkThread::run_service() exits

Bengt Rutisson bengt.rutisson at oracle.com
Tue Mar 15 11:55:24 UTC 2016


Hi again,

I am working on an update to this webrev. So, please hold off with 
reviews of the patch below.

Thanks,
Bengt

On 2016-03-14 12:23, Bengt Rutisson wrote:
>
> Hi all,
>
> Could I have a couple of reviews for this change?
>
> http://cr.openjdk.java.net/~brutisso/8151336/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8151336
>
> The run_service() loop in ConcurrentMarkThread looks like this:
>
>   while (!_should_terminate) {
>     // wait until started is set.
>     sleepBeforeNextCycle();
>     if (_should_terminate) {
>       _cm->root_regions()->cancel_scan();
>       break;
>     }
>     // do all the work
>  }
>
> If a full GC is triggered while the ConcurrentMarkThread is in "do all 
> the work" the full GC will wait for the root region scan. But if we at 
> the same time decide to exit the VM we will set _should_terminate to 
> true, which will cause the while() loop to not continue and we won't 
> get to the cancel_scan call.
>
> The proposed fix moves the call to cancel_scan() until after the while 
> loop has exited. That way we will always cancel any pending root 
> region scanning.
>
> I also introduce a _has_terminated state for G1CMRootRegions to makes 
> sure that another root region scanning can't be initialized once the 
> CM thread has exited. This also called for a rename of cancel_scan() 
> to terminate().
>
> Thanks,
> Bengt



More information about the hotspot-gc-dev mailing list