RFR: 8270842: G1: Only young regions need to redirty outside references in remset.

Thomas Schatzl tschatzl at openjdk.java.net
Thu Jul 22 10:28:43 UTC 2021


On Wed, 21 Jul 2021 02:13:38 GMT, Hamlin Li <mli at openjdk.org> wrote:

> For evac failure objects in non-young regions (old) of cset, the outside reference remset already recorded in the dirty queue, we only needs to do it for obj in young regions

Instead of trying to optimize this scanning a bit, did you consider avoiding this rescan for all types of regions?

It seems that the code for skipping the enqueuing for young region is this:

oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markWord m) {
  assert(_g1h->is_in_cset(old), "Object " PTR_FORMAT " should be in the CSet", p2i(old));

  oop forward_ptr = old->forward_to_atomic(old, m, memory_order_relaxed);
  if (forward_ptr == NULL) {
    // Forward-to-self succeeded. We are the "owner" of the object.
    HeapRegion* r = _g1h->heap_region_containing(old);

    if (_g1h->notify_region_failed_evacuation(r->hrm_index())) {
      _g1h->hr_printer()->evac_failure(r);
    }

    _g1h->preserve_mark_during_evac_failure(_worker_id, old, m);

    G1ScanInYoungSetter x(&_scanner, r->is_young());
    old->oop_iterate_backwards(&_scanner);



I.e. just as a thought, would it be worth a try to fake an "old" region by doing

    // Always make the scanning assume this is from an old region, causing it to collect
    // dirty cards for remembered sets as we will turn this region with a failed allocation
    // into old later.
    G1ScanInYoungSetter x(&_scanner, false);

I have not really checked this actually works, but it seems a nice hack to avoid the rescanning if it worked.

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

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


More information about the hotspot-gc-dev mailing list