JDK-8181214 : ReferenceProcessor should shortcut execution on empty lists
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 10
  • Priority: P3
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2017-05-30
  • Updated: 2023-08-21
  • Resolved: 2017-06-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10
10Resolved
Related Reports
Duplicate :  
Relates :  
Description
Current ReferenceProcessor implementation does several passes over several lists of references, in order of their weakness.

In MT mode, it submits the processing task to the supplied executor, in hope that parallelism would be beneficial. However, in many cases, either the lists of references is empty, or the number of actual references is zero (e.g. after CMS-style pre-cleaning), or the number of references falls to zero in the following phases.

This makes RP to start the executor task, even if we know there is no work. We would then waste time waiting for threads to wake up, discover there is no work, rendezvous and terminate.

It makes sense to check the amount of work before even submitting work to executor, for example, with:
  http://cr.openjdk.java.net/~shade/8181214/webrev.02/

This saves 0.5-4 ms of pause time for low-latency GCs like Shenandoah.
Comments
Agreed. Seems to be the special case of JDK-8043575.
06-06-2017

This looks very similar to JDK-8043575, maybe even a duplicate.
01-06-2017

Patch from http://cr.openjdk.java.net/~shade/8181214/webrev.02/ -- currently fails on one test with G1: http://cr.openjdk.java.net/~shade/8181214/hs_err_pid21171.log
30-05-2017