RFR: Specialize ShenandoahGenerationType to avoid generational check penalty on fast paths

Aleksey Shipilev shade at openjdk.org
Thu Apr 13 13:49:47 UTC 2023


The target for this PR is to resolve the performance TODO at `ShenandoahMark::mark_through_ref`.
The same can probably be used in native barrier code too, if we decide to specialize those with `GENERATION`.

With sample HyperAlloc test that is configured to stress the marking code:


$ java -XX:+UseShenandoahGC -XX:+UnlockDiagnosticVMOptions -XX:ShenandoahGCMode=passive -XX:-ShenandoahDegeneratedGC -Xlog:gc+stats -Xms1g -Xmx1g -XX:+AlwaysPreTouch -XX:ParallelGCThreads=1 -jar HyperAlloc-1.0.jar -d 30 -s 800 -t 1


We have consistent improvements in mark times for about 2.5%, look at average times below:


# Baseline

[31.009s][info][gc,stats] Pause Full GC (G)              =   25.546 s (a =   532201 us) (n =    48) (lvls, us =   203125,   539062,   542969,   544922,   559177)
[31.009s][info][gc,stats] Pause Full GC (N)              =   25.543 s (a =   532136 us) (n =    48) (lvls, us =   203125,   539062,   542969,   544922,   559061)
[31.009s][info][gc,stats]   Mark                         =   10.076 s (a =   209922 us) (n =    48) (lvls, us =    74609,   212891,   212891,   212891,   215692)

[31.065s][info][gc,stats] Pause Full GC (G)              =   25.618 s (a =   533715 us) (n =    48) (lvls, us =   230469,   541016,   542969,   544922,   556460)
[31.065s][info][gc,stats] Pause Full GC (N)              =   25.615 s (a =   533650 us) (n =    48) (lvls, us =   230469,   539062,   542969,   544922,   556338)
[31.065s][info][gc,stats]   Mark                         =   10.090 s (a =   210202 us) (n =    48) (lvls, us =    83398,   212891,   212891,   214844,   217067)

[30.975s][info][gc,stats] Pause Full GC (G)              =   25.613 s (a =   533606 us) (n =    48) (lvls, us =   201172,   539062,   544922,   546875,   558696)
[30.975s][info][gc,stats] Pause Full GC (N)              =   25.611 s (a =   533566 us) (n =    48) (lvls, us =   201172,   539062,   544922,   546875,   558576)
[30.975s][info][gc,stats]   Mark                         =   10.152 s (a =   211491 us) (n =    48) (lvls, us =    73633,   214844,   214844,   214844,   218065)

# Patched

[30.607s][info][gc,stats] Pause Full GC (G)              =   25.224 s (a =   525492 us) (n =    48) (lvls, us =   216797,   531250,   537109,   539062,   541888)
[30.607s][info][gc,stats] Pause Full GC (N)              =   25.220 s (a =   525411 us) (n =    48) (lvls, us =   216797,   531250,   537109,   539062,   541788)
[30.607s][info][gc,stats]   Mark                         =    9.841 s (a =   205013 us) (n =    48) (lvls, us =    77734,   207031,   208984,   208984,   211176)

[30.647s][info][gc,stats] Pause Full GC (G)              =   25.293 s (a =   526937 us) (n =    48) (lvls, us =   287109,   531250,   535156,   539062,   545759)
[30.647s][info][gc,stats] Pause Full GC (N)              =   25.290 s (a =   526868 us) (n =    48) (lvls, us =   287109,   531250,   535156,   539062,   545660)
[30.647s][info][gc,stats]   Mark                         =    9.833 s (a =   204856 us) (n =    48) (lvls, us =   101562,   207031,   207031,   207031,   212495)

[30.640s][info][gc,stats] Pause Full GC (G)              =   25.193 s (a =   524860 us) (n =    48) (lvls, us =   210938,   531250,   535156,   537109,   540524)
[30.640s][info][gc,stats] Pause Full GC (N)              =   25.190 s (a =   524792 us) (n =    48) (lvls, us =   210938,   531250,   535156,   537109,   540420)
[30.640s][info][gc,stats]   Mark                         =    9.830 s (a =   204788 us) (n =    48) (lvls, us =    76367,   207031,   207031,   208984,   210008)

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

Commit messages:
 - More work
 - Micro-optimize in_generation
 - Touchups
 - Cleanups
 - Initial work

Changes: https://git.openjdk.org/shenandoah/pull/254/files
 Webrev: https://webrevs.openjdk.org/?repo=shenandoah&pr=254&range=00
  Stats: 166 lines in 15 files changed: 74 ins; 26 del; 66 mod
  Patch: https://git.openjdk.org/shenandoah/pull/254.diff
  Fetch: git fetch https://git.openjdk.org/shenandoah.git pull/254/head:pull/254

PR: https://git.openjdk.org/shenandoah/pull/254


More information about the shenandoah-dev mailing list