JDK-8227174 : Lazily set card table of allocated regions to correct values in G1
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2019-07-03
  • Updated: 2021-08-20
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Currently G1 always sets the card table to all-clean during GC and updates it to the appropriate value during allocation (i.e. young).

Observation is that in the large majority of cases, during stable operation, the same regions get allocated to the same type due to how young/old is seggregated during allocation. I.e. a recently cleared young region will be allocated as young almost immediately anyway, wasting the time and effort to first clean and then set to young.

Also, setting all cards to all-clean for all regions takes a lot of time during GC, particularly in throughput oriented large heap loads around 7-10% of pause time.

Investigate doing the clearing lazily, keeping the as-young-marked regions during gc.
Comments
There is a prototype for this; the problem is that there may be some memory ordering issues wrt to the current post write barrier. May be investigated with the proposed changes in JDK-8226731 again. Another option could be having two card tables that are switched at every GC, i.e. one used while the other being cleared.
06-11-2019