Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8349213

G1: Clearing bitmaps during collection set merging not claimed by region

XMLWordPrintable

    • gc
    • b26
    • 20
    • b10

        There is some (seldom) executed code during merging the remembered set where G1 needs to clear the bitmap of old regions during GC.

        The problem is that this clearing (and actually all other code executed in that G1ClearBitmapClosure) is not claimed by G1HeapRegion, i.e. every thread does that reset work for every region, duplicating work.

        This is unnecessary - it is enough that a G1HeapRegion gets cleared once by whatever thread.

        I.e. in this code in G1RemSet.cpp / G1MergeHeapRootsTask::work():

              {
                // 2. collection set
                G1MergeCardSetClosure merge(_scan_state);
                G1ClearBitmapClosure clear(g1h);
                G1CombinedClosure combined(&merge, &clear);

                if (_initial_evacuation) {
                  G1HeapRegionRemSet::iterate_for_merge(g1h->young_regions_cardset(), merge);
                }

                g1h->collection_set_iterate_increment_from(&combined, nullptr, worker_id);

        Since that last call does not have a HeapRegionClaimer, G1ClearBitmapClosure is executed for every region for every thread. Note that the G1MergeCardSetClosure does internal claiming so it is not affected (i.e. does not do duplicate work).

        Caused by JDK-8296954.

              tschatzl Thomas Schatzl
              tschatzl Thomas Schatzl
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: