RFR: 8252752: Clear card table for old regions during scan in G1

Thomas Schatzl tschatzl at openjdk.java.net
Fri Sep 25 09:23:14 UTC 2020


Hi all,

  can I get reviews for this change that removes the need for explicit clearing of the card table for typically a large
  amount of regions in most cases?

Currently g1 unconditionally marks scanned dirty cards as "scanned" to remember that they had already been scanned in
earlier evacuation passes. Then in the "clear card table phase" g1 clears all these marks including the card table of
evacuated regions.

This change modifies g1 so that if possible, it clears dirty cards after scanning them instead of setting them to
"scanned" if there is only one evacuation pass. This saves a lot of work later (e.g. the amount of regions to clear in
the clear card table phase may be reduced by a magnitude or more, depending on the ration between evacuated and scanned
regions).

The main change here is which type of regions (ones in the collection set, ones that are only scanned) are put into
which list of regions g1 already manages: there is one "all" list containing all regions that need clearing, and a
"next" list containing the regions to be scanned in the current evacuation pass. Previously g1 put regions into at
least one list; now regions in the current collection set are always directly put into the "all" list (as they
independently of other reasons require card table cleaning), while to-be-scanned regions are always only put into the
"next" list.

Then, to achieve the desired effect that only regions that absolutely require clearing are in the "all" list, g1 does
not merge the "next" list into the "all" list when it detects that there will only be one evacuation pass.

Performance impact:
Decreases clear card table time significantly if the number of regions in the collection set is much smaller than the
number of scanned regions (as it decreases the number of regions to clear). Some cursory perf testing showed slight
overall pause time improvements.

Testing:
hs-tier1-5 ("Initial import" change)
hs-tier1-2 (latest)

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

Commit messages:
 - Last changes
 - Some final renaming
 - Initial import

Changes: https://git.openjdk.java.net/jdk/pull/343/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=343&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8252752
  Stats: 107 lines in 6 files changed: 67 ins; 11 del; 29 mod
  Patch: https://git.openjdk.java.net/jdk/pull/343.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/343/head:pull/343

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



More information about the hotspot-gc-dev mailing list