RFR: JDK-8262068: Improve G1 Full GC by skipping compaction for regions with high survival ratio

Hamlin Li mli at openjdk.java.net
Sat Feb 27 06:36:01 UTC 2021


Summary
-----------

Improve G1 Full GC by skip compaction for regions with high survival ratio.

Backgroud
-----------

There are 4 steps in full gc of G1 GC.
- mark live objects
- prepare forwardee
- adjust pointers
- compact

When full gc occurs, there may be very high percentage of live bytes in some regions. For these regions, it's not efficient to compact them and better to skip them, as there are little space to save but many objects to copy.

Description
-----------

We enhance the full gc implementation for the above situation through following steps:
- accumulate live bytes of every hr in mark phase;
- add hr's with high percentage of live bytes into a "no moving" set rather the normal compaction set in prepare phase, and fill dummy objects in the places of dead objects in these hr's;
- nothing special is done in adjust phase;
- just compact the regions in compaction set;

VM options added
-----------

- G1FullGCNoMoving: enable "no moving region" mode in G1 Full GC.
- G1NoMovingRegionLiveBytesLowerThreshold: the lower threshold (percent) of heap region live bytes to skip compaction

Test
-----------

- specjbb2015: no regression
- dacapo: 3%-11% improvement of full gc pause. Attachment is the dacapo h2 full gc pause.

$ java -Xmx1g -Xms1g -XX:ParallelGCThreads=4 -Xlog:gc*=info:file=gc.log -jar dacapo-9.12-bach.jar --iterations 5 --size huge --no-pre-iteration-gc h2

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

Commit messages:
 - JDK-8262068: Improve G1 Full GC by skipping compaction for regions with high survival ratio

Changes: https://git.openjdk.java.net/jdk/pull/2760/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2760&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262068
  Stats: 287 lines in 16 files changed: 274 ins; 1 del; 12 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2760.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2760/head:pull/2760

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



More information about the hotspot-gc-dev mailing list