8379174: G1: Too high G1RemSetArrayOfCardsEntriesBase causes invalid ergonomic G1RemSetArrayOfCardsEntries

Reviewed-by: tschatzl, iwalulya
This commit is contained in:
Guanqiang Han 2026-04-01 09:12:51 +00:00 committed by Thomas Schatzl
parent 0dfa22f27d
commit e340aeeee0
2 changed files with 45 additions and 1 deletions

View File

@ -148,8 +148,9 @@ void G1Arguments::initialize_card_set_configuration() {
if (FLAG_IS_DEFAULT(G1RemSetArrayOfCardsEntries)) {
uint max_cards_in_inline_ptr = G1CardSetConfiguration::max_cards_in_inline_ptr(G1HeapRegion::LogCardsPerRegion);
const JVMTypedFlagLimit<uint>* limit = JVMFlagLimit::get_range_at(FLAG_MEMBER_ENUM(G1RemSetArrayOfCardsEntries))->cast<uint>();
FLAG_SET_ERGO(G1RemSetArrayOfCardsEntries, MAX2(max_cards_in_inline_ptr * 2,
G1RemSetArrayOfCardsEntriesBase << region_size_log_mb));
MIN2(G1RemSetArrayOfCardsEntriesBase << region_size_log_mb, limit->max())));
}
// Howl card set container globals.

View File

@ -0,0 +1,43 @@
/*
* Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 8379174
* @summary Test for G1 ergonomics deriving an out-of-range
* G1RemSetArrayOfCardsEntries value from G1RemSetArrayOfCardsEntriesBase
* @requires vm.gc.G1
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
* -XX:+UseG1GC
* -XX:G1RemSetArrayOfCardsEntriesBase=62117
* -XX:G1HeapRegionSize=4m
* ${test.main.class}
*/
package gc.g1;
public class TestG1RemSetArrayOfCardsEntriesErgoLimit {
public static void main(String[] args) {
System.out.println("passed");
}
}