[jdk17] RFR: 8268265: MutableSpaceUsedHelper::take_sample() hits assert(left >= right) failed: avoid overflow [v2]
Kim Barrett
kbarrett at openjdk.java.net
Thu Jun 17 19:09:57 UTC 2021
> Please review this change to PerfData-based heap usage reporting by SerialGC
> and ParallelGC.
>
> For both of these collectors, the periodic heap usage sampling and reporting
> by the Watcher thread involves sampling the difference between each space's
> current allocation pointer and its base pointer. But the Watcher thread
> runs during GC safepoints, which means that sampling may occasionally occur
> while the GC is in the process of updating the space being sampled. This
> can result in a sample with a bogus value or even an assertion failure after
> JDK-8260046.
>
> Other collectors seem to avoid this by sampling and recording the heap usage
> value at specific synchronous times rather than asynchronously by the
> Watcher thread.
>
> There isn't a particularly good place for synchronous updates for ParallelGC
> and SerialGC, so this change doesn't do so. Instead, it makes the existing
> asynchronous updates safe from interference by an in-progress GC. This is
> done by having the update done under the Heap_lock. Introducing a more
> fine-grained lock has the same problem as doing synchronous updates. Rather
> than possibly blocking the sampling Watcher thread for the duration of a GC,
> it tries to lock the Heap_lock and skips sampling if it's not available.
>
> Testing:
> mach5 tier1-3, 5, 7 (3,5,7 are where focused Serial and ParallelGC testing is done).
Kim Barrett has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
- Merge branch 'master' into lock_heap
- serial: sample carefully
- parallelgc - sample carefully
-------------
Changes:
- all: https://git.openjdk.java.net/jdk17/pull/65/files
- new: https://git.openjdk.java.net/jdk17/pull/65/files/a04516e8..754fdf4c
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk17&pr=65&range=01
- incr: https://webrevs.openjdk.java.net/?repo=jdk17&pr=65&range=00-01
Stats: 1967 lines in 73 files changed: 1133 ins; 563 del; 271 mod
Patch: https://git.openjdk.java.net/jdk17/pull/65.diff
Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/65/head:pull/65
PR: https://git.openjdk.java.net/jdk17/pull/65
More information about the hotspot-gc-dev
mailing list