[jdk17] Integrated: 8268265: MutableSpaceUsedHelper::take_sample() hits assert(left >= right) failed: avoid overflow
Kim Barrett
kbarrett at openjdk.java.net
Thu Jun 17 19:09:59 UTC 2021
On Tue, 15 Jun 2021 21:37:06 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
> 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).
This pull request has now been integrated.
Changeset: c98d5084
Author: Kim Barrett <kbarrett at openjdk.org>
URL: https://git.openjdk.java.net/jdk17/commit/c98d50848ba2811d2f08b3fbc57ac9674c63a943
Stats: 52 lines in 4 files changed: 38 ins; 4 del; 10 mod
8268265: MutableSpaceUsedHelper::take_sample() hits assert(left >= right) failed: avoid overflow
Reviewed-by: tschatzl, iwalulya
-------------
PR: https://git.openjdk.java.net/jdk17/pull/65
More information about the hotspot-gc-dev
mailing list