[jdk17] Integrated: 8268265: MutableSpaceUsedHelper::take_sample() hits assert(left >= right) failed: avoid overflow
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
> 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.
> mach5 tier1-3, 5, 7 (3,5,7 are where focused Serial and ParallelGC testing is done).
This pull request has now been integrated.
Author: Kim Barrett <kbarrett at openjdk.org>
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
More information about the hotspot-gc-dev