RFR: 8325202: gc/g1/TestMarkStackOverflow.java intermittently crash: G1CMMarkStack::ChunkAllocator::allocate_new_chunk

Thomas Schatzl tschatzl at openjdk.org
Tue Feb 20 10:59:54 UTC 2024


On Mon, 19 Feb 2024 11:04:16 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Please review this bug fix to guarantee that expanding the G1CMMarkStack considers the expected capacity for the thread triggering the expansion instead of expanding based on current capacity. 
> 
> Testing: - Tier 1 -3 
>                - 2M test iterations (bug is reproducible ~1/100k test iterations)

Changes requested by tschatzl (Reviewer).

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 155:

> 153:     MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
> 154:     if (Atomic::load_acquire(&_buckets[bucket]) == nullptr) {
> 155:       size_t new_capacity = bucket_size(bucket) * 2;

A `MIN2` guard to avoid going over max capacity seems to be missing here.

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp line 216:

> 214: 
> 215: bool G1CMMarkStack::ChunkAllocator::expand() {
> 216:   // Double capacity if possible.

Better move this to the hpp file, see suggestion there.

src/hotspot/share/gc/g1/g1ConcurrentMark.hpp line 228:

> 226:     size_t capacity() const { return _capacity; }
> 227: 
> 228:     bool expand();

Suggestion:

    // Expand the mark stack doubling its size.
    bool expand();

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

PR Review: https://git.openjdk.org/jdk/pull/17912#pullrequestreview-1890126595
PR Review Comment: https://git.openjdk.org/jdk/pull/17912#discussion_r1495622318
PR Review Comment: https://git.openjdk.org/jdk/pull/17912#discussion_r1495622772
PR Review Comment: https://git.openjdk.org/jdk/pull/17912#discussion_r1495621293


More information about the hotspot-gc-dev mailing list