JDK-7055086 : G1: can rely on used_region_at_save_marks() outside a GC
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs22
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic
  • CPU: generic
  • Submitted: 2011-06-15
  • Updated: 2018-03-28
  • Resolved: 2018-03-28
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
tbd_majorResolved
Related Reports
Relates :  
Description
In G1 we can scan cards both during and outside a STW GC. We typically don't want to scan objects that have been copied to a region during a GC. So, we use the save_marks() mechanism to checkpoint top before we start copying objects into the region so that we bound any card scanning by the checkpointed top.

To avoid calling save_marks() on all regions before a GC we rely on a timestamp mechanism. When we call save_marks() on a region we will start allocating to during the GC we tag said region with the current GC timestamp. So, the card scanning is bound by either top_at_save_marks(), if the region's timestamp is current, or top() if it's not. The timestamp is incremented once at the start of a GC which essentially invalidates all the previous save_marks() information.

When we scan cards outside GC we always want to use top and ignore save_marks(). So the card scanning code looks like this:

  if (G1CollectedHeap::heap()->is_gc_active()) {
    mr = mr.intersection(used_region_at_save_marks());
  } else {
    mr = mr.intersection(used_region());
  }

On a separate changeset (7039627) we are changing the code to also increment the timestamp at the end of a GC. This essentially invalidates the save_marks() information on all regions. So we have an opportunity to remove the above check and always rely on the used_region_at_save_marks() returning the right value whether we are during a pause or outside one.

Comments
This issue does not exist any more because we use a different mechanism for getting stable top's: - during gc we take an explicit snapshot of the top's of regions - during concurrent phase the top() of the regions is stable
28-03-2018

Since JDK-8065358 we do not use the save_marks() in G1 any more but G1 has its own "scan_top()".
14-01-2016

EVALUATION See Description.
15-06-2011