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

Per Liden per.liden at oracle.com
Tue Mar 15 18:53:06 UTC 2016


Hi Bengt,

On 15 Mar 2016, at 16:11, Bengt Rutisson <bengt.rutisson at oracle.com> wrote:

Hi again everyone, Here's an updated webrev: http://cr.openjdk.java.net/~brutisso/8151336/webrev.01 I removed the extra hasterminated state and am instead using the ConcurrentMarkThread::shouldterminate() state to make sure we don't start a new initial mark if the concurrent mark thread is about to terminate or has already terminated. The shouldterminate state is set in ConcurrentGCThread::stop() where we first take the Terminatorlock with a safepoint check. So, we should be able to rely on this value inside of docollectionpauseatsafepoint().

This looks correct as far as I can tell. Reviewed.

cheers, Per

Thanks, Bengt On 2016-03-15 12:55, Bengt Rutisson wrote:

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 runservice() loop in ConcurrentMarkThread looks like this: while (!shouldterminate) { // wait until started is set. sleepBeforeNextCycle(); if (shouldterminate) { cm->rootregions()->cancelscan(); 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 shouldterminate to true, which will cause the while() loop to not continue and we won't get to the cancelscan call. The proposed fix moves the call to cancelscan() until after the while loop has exited. That way we will always cancel any pending root region scanning. I also introduce a hasterminated 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 cancelscan() to terminate(). Thanks, Bengt



More information about the hotspot-gc-dev mailing list