JDK-8273137 : Improve skipping card enqueuing during gc if there are no remembered sets in old gen
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 18
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-08-30
  • Updated: 2024-10-11
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 :  
Description
This code

template <class T>
inline void G1ScanEvacuatedObjClosure::do_oop_work(T* p) {
[...]
  } else if (!HeapRegion::is_in_same_region(p, obj)) {
    handle_non_cset_obj_common(region_attr, p, obj);
    assert(_scanning_in_young != Uninitialized, "Scan location has not been initialized.");
    if (_scanning_in_young == True) {
      return;
    }
    _par_scan_state->enqueue_card_if_tracked(region_attr, p, obj); // !----------------------
  }
}

is going to enqueue cards into the refinement buffers (slightly abridged) that contain "interesting" references, i.e. need reference update.

The check above is a shortcut to avoid the method call (and its additional checks) for cases that "obviously" do not need cards.

Another check that could be done (and should probably be added to the assignment of _scanning_in_young) is that if there is absolutely no non-young gen region with a remembered set, then this attempt to enqueue will also always fail.

So the idea is to somewhere store whether this is the case (i.e. store and maintain the number of non-young regions with remset), and use it in the G1ScanInYoungSetter.

This could be interesting as the case when there is no non-young gen region with remembered sets may be fairly common (i.e. during young-only phase, up until the remark pause) as long as there are no humongous object candidates.

Investigate and test