RFR: 8265116: ZGC: Steal local stacks instead of flushing them

Per Liden pliden at openjdk.java.net
Tue Apr 13 08:25:06 UTC 2021


As part of addressing the issue of excessive mark stack usage, it was observed that sometimes mark stack utilization can be very low. For example, casparcwang at tencent.com reported that when running Apache Zookeeper, mark stack utilization was ~10%.

The problem is that GC workers are a bit too eager to flush mark stacks. Currently, whenever a GC worker has drained its home stripe it will always flush all remaining mark stacks. This causes non-full mark stacks to be flushed. This in turn means that the GC worker who receives that non-full stack (small amount of work) tends to also produce non-full stacks (small amount of work) for other GC workers. This can lead to a vicious cycle, which results in excessive mark stack memory usage.

The solution proposed here is to not let GC workers flush non-full stacks. After draining the home stripe, a GC worker will instead try to steal any non-full local stack belonging to a different stripe, and if no such stacks exist it will (as it does today) try to steal a global stack belonging to a different stripe.

(Note: This PR only addresses one part of the mark stack usage problem. Other improvements, such as the discussed "mark before push"-patch will be a separate PR).

Testing:
 * Tier1-7.
 * SPECjbb2015, score and mark times unaffected.
 * casparcwang at tencent.com reports that this patch (in combination with the "mark before push"-patch) solves the problem for Apache Zookeeper.

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

Commit messages:
 - 8265116: ZGC: Steal local stacks instead of flushing them

Changes: https://git.openjdk.java.net/jdk/pull/3455/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3455&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8265116
  Stats: 41 lines in 4 files changed: 25 ins; 2 del; 14 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3455.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3455/head:pull/3455

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



More information about the hotspot-gc-dev mailing list