RFR: 8261759: ZGC: ZWorker Threads Continue Marking After System.exit() called [v3]

Per Liden pliden at openjdk.java.net
Mon Apr 19 13:22:38 UTC 2021


On Mon, 19 Apr 2021 13:14:58 GMT, Per Liden <pliden at openjdk.org> wrote:

>> During JVM termination, ZCollectedHeap::stop() currently only returns once any ongoing GC cycle has completed. However, waiting for a GC cycle to complete can take awhile, so the JVM might not terminate as promptly as one might expect.
>> 
>> This patch adds abortion checks to workers doing marking and relocation to allow ZWorker threads to terminate promptly. In addition, before and after concurrent phases, the ZDriver thread checks if `should_terminate()` is true and prematurely terminates the GC cycle if that's the case.
>> 
>> Testing:
>>  * Tier1-7 on Linux.
>>  * SPECjbb2015, comparing score and marking times against baseline (5 iterations each), no difference observed.
>>  * Ad-hoc programs calling System.exit() during marking/relocation.
>>  * Manual Ctrl-C testing.
>
> Per Liden has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Forward in-place if GC aborted

PR updated with "Forward in-place if GC aborted" commit. This resolves a possible dead-lock during JVM shutdown where the GC has been ordered to stop/abort but there are Java threads that failed to relocate an object and are now waiting for the GC to do it for them. In this cases, we signal to all such waiters that the GC har aborted and that they should just go ahead and forward the object in-place.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3453



More information about the hotspot-gc-dev mailing list