RFR: 8307058: Implementation of Generational ZGC [v13]

Stefan Karlsson stefank at openjdk.org
Thu May 11 12:12:56 UTC 2023


> Hi all,
> 
> Please review the implementation of Generational ZGC, which can be turned on by adding -XX:+ZGenerational in addition to using -XX:+UseZGC. Generational ZGC is a major rewrite of the non-generational ZGC version that exists in the openjdk/jdk repository. It splits the heap into two generations; the young generation where newly allocated objects are born, and the old generation where long-lived objects get promoted to. The motivation for introducing generations is to allow ZGC to reclaim memory faster by not having to walk the entire object graph every time a garbage collection is run. This should make Generational ZGC suitable for more workloads. In particular workloads that previously hit allocation stalls because of high allocation rates, large live sets, or limited spare machine resources, have the potential to work better with Generational ZGC. For an in-depth description of Generational ZGC, see https://openjdk.org/jeps/439.
> 
> The development of Generational ZGC started around the same time as the development of JDK 17. At that point we forked off the Generational ZGC development into its own branch and let non-generational live unaffected in openjdk/jdk. This safe-guarded non-generational ZGC and allowed Generational ZGC to move unhindered, without the shackles of having to fit into another GC implementation's design and quirks. Since then, almost all of the ZGC files have been changed. Moving forward to today, when it's ready for us to upstream Generational ZGC, we now need to deliver Generational ZGC without disrupting our current user-base. We have therefore opted to initially include both versions of ZGC in the code base, but with the intention to deprecate non-generational ZGC in a future release. Existing users running with only -XX:+UseZGC will get the non-generational ZGC, and users that want the new Generational ZGC need to run with -XX:+ZGenerational in addition to -XX:+UseZGC. The intention i
 s to give the users time to validate and deploy their workloads with the new GC implementation.
> 
> Including both the new evolution of a GC and its legacy predecessor poses a few challenges for us GC developers. The first reaction could be to try to mash the two implementations together and sprinkle the GC code with conditional statements or dynamic dispatches. We have done similar experiments before. When ZGC was first born, we started an experiment where we converted G1 into getting the same features as the evolving ZGC. It was quite clea...

Stefan Karlsson has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 932 commits:

 - Merge remote-tracking branch 'upstream/master' into zgc_generational_review
 - Make barrier_Relocation inherit from Relocation instead of DataRelocation
 - ZGC: Generational
   
   Co-authored-by: Stefan Karlsson <stefank at openjdk.org>
   Co-authored-by: Per Liden <pliden at openjdk.org>
   Co-authored-by: Albert Mingkun Yang <ayang at openjdk.org>
   Co-authored-by: Erik Österlund <eosterlund at openjdk.org>
   Co-authored-by: Axel Boldt-Christmas <aboldtch at openjdk.org>
   Co-authored-by: Stefan Johansson <kstefanj at openjdk.org>
 - UPSTREAM: RISCV tmp reg cleanup resolve_jobject
 - CLEANUP: barrierSetNMethod_aarch64.cpp
 - UPSTREAM: assembler_ppc CMPLI
   
   Co-authored-by: TheRealMDoerr <martin.doerr at sap.com>
 - UPSTREAM: assembler_ppc ANDI
   
   Co-authored-by: TheRealMDoerr <martin.doerr at sap.com>
 - Merge branch 'zgc_generational' into zgc_generational_rebase_target
 - Workaround failed reservation in ZForwardingTest
 - ZGC: Generational
   
   Co-authored-by: Stefan Karlsson <stefank at openjdk.org>
   Co-authored-by: Per Liden <pliden at openjdk.org>
   Co-authored-by: Albert Mingkun Yang <ayang at openjdk.org>
   Co-authored-by: Erik Österlund <eosterlund at openjdk.org>
   Co-authored-by: Axel Boldt-Christmas <aboldtch at openjdk.org>
   Co-authored-by: Stefan Johansson <kstefanj at openjdk.org>
 - ... and 922 more: https://git.openjdk.org/jdk/compare/0cbfbc40...9dd9681b

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

Changes: https://git.openjdk.org/jdk/pull/13771/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13771&range=12
  Stats: 67359 lines in 684 files changed: 58192 ins; 4252 del; 4915 mod
  Patch: https://git.openjdk.org/jdk/pull/13771.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13771/head:pull/13771

PR: https://git.openjdk.org/jdk/pull/13771


More information about the hotspot-dev mailing list