Skip to content
This repository was archived by the owner on Apr 24, 2023. It is now read-only.
/ jdk20 Public archive

Commit ea40f29

Browse files
author
Kim Barrett
committed
8298215: gc/g1/TestVerifyGCType.java failed with "Missing expected verification pattern Verifying After GC for: Pause Young (Prepare Mixed): expected true, was false"
Reviewed-by: iwalulya, tschatzl
1 parent d0a7679 commit ea40f29

File tree

4 files changed

+23
-45
lines changed

4 files changed

+23
-45
lines changed

src/hotspot/share/gc/g1/g1Policy.cpp

+14-34
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,14 @@ uint G1Policy::calculate_desired_eden_length_by_mmu() const {
190190
void G1Policy::update_young_length_bounds() {
191191
assert(!Universe::is_fully_initialized() || SafepointSynchronize::is_at_safepoint(), "must be");
192192
bool for_young_only_phase = collector_state()->in_young_only_phase();
193-
// Request at least one eden region to ensure progress.
194-
bool after_gc = true;
195193
update_young_length_bounds(_analytics->predict_pending_cards(for_young_only_phase),
196-
_analytics->predict_rs_length(for_young_only_phase),
197-
after_gc);
194+
_analytics->predict_rs_length(for_young_only_phase));
198195
}
199196

200-
void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length, bool after_gc) {
197+
void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length) {
201198
uint old_young_list_target_length = young_list_target_length();
202199

203-
uint new_young_list_desired_length = calculate_young_desired_length(pending_cards, rs_length, after_gc);
200+
uint new_young_list_desired_length = calculate_young_desired_length(pending_cards, rs_length);
204201
uint new_young_list_target_length = calculate_young_target_length(new_young_list_desired_length);
205202
uint new_young_list_max_length = calculate_young_max_length(new_young_list_target_length);
206203

@@ -239,7 +236,7 @@ void G1Policy::update_young_length_bounds(size_t pending_cards, size_t rs_length
239236
// value smaller than what is already allocated or what can actually be allocated.
240237
// This return value is only an expectation.
241238
//
242-
uint G1Policy::calculate_young_desired_length(size_t pending_cards, size_t rs_length, bool after_gc) const {
239+
uint G1Policy::calculate_young_desired_length(size_t pending_cards, size_t rs_length) const {
243240
uint min_young_length_by_sizer = _young_gen_sizer.min_desired_young_length();
244241
uint max_young_length_by_sizer = _young_gen_sizer.max_desired_young_length();
245242

@@ -253,18 +250,18 @@ uint G1Policy::calculate_young_desired_length(size_t pending_cards, size_t rs_le
253250
// Size of the already allocated young gen.
254251
const uint allocated_young_length = _g1h->young_regions_count();
255252
// This is the absolute minimum young length that we can return. Ensure that we
256-
// don't go below any user-defined minimum bound; but we might have already
257-
// allocated more than that for various reasons. In this case, use that.
258-
uint absolute_min_young_length = MAX2(allocated_young_length, min_young_length_by_sizer);
253+
// don't go below any user-defined minimum bound. Also, we must have at least
254+
// one eden region, to ensure progress. But when revising during the ensuing
255+
// mutator phase we might have already allocated more than either of those, in
256+
// which case use that.
257+
uint absolute_min_young_length = MAX3(min_young_length_by_sizer,
258+
survivor_length + 1,
259+
allocated_young_length);
259260
// Calculate the absolute max bounds. After evac failure or when revising the
260261
// young length we might have exceeded absolute min length or absolute_max_length,
261262
// so adjust the result accordingly.
262263
uint absolute_max_young_length = MAX2(max_young_length_by_sizer, absolute_min_young_length);
263264

264-
// The absolute minimum young gen length (as provided by the young gen sizer) ensures
265-
// that we desire at least one young gen region.
266-
assert(absolute_min_young_length > 0, "must be");
267-
268265
uint desired_eden_length_by_mmu = 0;
269266
uint desired_eden_length_by_pause = 0;
270267

@@ -293,28 +290,14 @@ uint G1Policy::calculate_young_desired_length(size_t pending_cards, size_t rs_le
293290
// Clamp to absolute min/max after we determined desired lengths.
294291
desired_young_length = clamp(desired_young_length, absolute_min_young_length, absolute_max_young_length);
295292

296-
// After a garbage collection, make room for at least one eden region (i.e. in addition to
297-
// already allocated survivor regions).
298-
// This may make desired regions go over absolute maximum length by the heap sizer, however
299-
// the immediate full gcs after that young gc (particularly on small heaps) are worse.
300-
if (after_gc && (allocated_young_length >= desired_young_length)) {
301-
log_trace(gc, ergo, heap)("Young desired length: Desired young region length less than already "
302-
"allocated region length, but requesting one eden region minimum. "
303-
"Expanding desired young length from %u to %u.",
304-
desired_young_length,
305-
allocated_young_length + 1);
306-
desired_young_length = allocated_young_length + 1;
307-
}
308-
309-
log_trace(gc, ergo, heap)("Young desired length %u (after gc: %s) "
293+
log_trace(gc, ergo, heap)("Young desired length %u "
310294
"survivor length %u "
311295
"allocated young length %u "
312296
"absolute min young length %u "
313297
"absolute max young length %u "
314298
"desired eden length by mmu %u "
315299
"desired eden length by pause %u ",
316-
desired_young_length, BOOL_TO_STR(after_gc),
317-
survivor_length,
300+
desired_young_length, survivor_length,
318301
allocated_young_length, absolute_min_young_length,
319302
absolute_max_young_length, desired_eden_length_by_mmu,
320303
desired_eden_length_by_pause);
@@ -548,10 +531,7 @@ void G1Policy::revise_young_list_target_length(size_t rs_length) {
548531
size_t thread_buffer_cards = _analytics->predict_dirtied_cards_in_thread_buffers();
549532
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
550533
size_t pending_cards = dcqs.num_cards() + thread_buffer_cards;
551-
// We are only revising young gen length to meet pause time goal, so do not request
552-
// at least one eden region for progress. At this point we actually want to run into
553-
// a GC soon if young gen is already (too) large.
554-
update_young_length_bounds(pending_cards, rs_length, false /* need_one_eden_region */);
534+
update_young_length_bounds(pending_cards, rs_length);
555535
}
556536

557537
void G1Policy::record_full_collection_start() {

src/hotspot/share/gc/g1/g1Policy.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ class G1Policy: public CHeapObj<mtGC> {
210210

211211
// Updates the internal young gen maximum and target and desired lengths.
212212
// If no parameters are passed, predict pending cards and the RS length using
213-
// the prediction model. If after_gc is set, make sure that there is one eden region
214-
// available (if there is enough space) to guarantee some progress.
213+
// the prediction model.
215214
void update_young_length_bounds();
216-
void update_young_length_bounds(size_t pending_cards, size_t rs_length, bool after_gc);
215+
void update_young_length_bounds(size_t pending_cards, size_t rs_length);
217216

218217
// Calculate and return the minimum desired eden length based on the MMU target.
219218
uint calculate_desired_eden_length_by_mmu() const;
@@ -241,7 +240,7 @@ class G1Policy: public CHeapObj<mtGC> {
241240

242241
// Calculate desired young length based on current situation without taking actually
243242
// available free regions into account.
244-
uint calculate_young_desired_length(size_t pending_cards, size_t rs_length, bool after_gc) const;
243+
uint calculate_young_desired_length(size_t pending_cards, size_t rs_length) const;
245244
// Limit the given desired young length to available free regions.
246245
uint calculate_young_target_length(uint desired_young_length) const;
247246
// The GCLocker might cause us to need more regions than the target. Calculate

test/hotspot/jtreg/ProblemList.txt

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
8080
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
8181
gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8241293,8298073 macosx-x64,macosx-aarch64
8282
gc/stress/TestStressG1Humongous.java 8286554 windows-x64
83-
gc/g1/TestVerifyGCType.java 8298215 linux-all,macosx-all
8483

8584
#############################################################################
8685

test/hotspot/jtreg/gc/g1/TestVerifyGCType.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,18 @@ private static void verifyCollection(String name, boolean expectBefore, boolean
190190
Asserts.assertTrue(ci != null, "Expected GC not found: " + name + "\n" + data);
191191

192192
// Verify Before
193-
verifyType(ci, expectBefore, VERIFY_BEFORE);
193+
verifyType(ci, expectBefore, VERIFY_BEFORE, data);
194194
// Verify During
195-
verifyType(ci, expectDuring, VERIFY_DURING);
195+
verifyType(ci, expectDuring, VERIFY_DURING, data);
196196
// Verify After
197-
verifyType(ci, expectAfter, VERIFY_AFTER);
197+
verifyType(ci, expectAfter, VERIFY_AFTER, data);
198198
}
199199

200-
private static void verifyType(CollectionInfo ci, boolean shouldExist, String pattern) {
200+
private static void verifyType(CollectionInfo ci, boolean shouldExist, String pattern, String data) {
201201
if (shouldExist) {
202-
Asserts.assertTrue(ci.containsVerification(pattern), "Missing expected verification pattern " + pattern + " for: " + ci.getName());
202+
Asserts.assertTrue(ci.containsVerification(pattern), "Missing expected verification pattern " + pattern + " for: " + ci.getName() + "\n" + data);
203203
} else {
204-
Asserts.assertFalse(ci.containsVerification(pattern), "Found unexpected verification pattern " + pattern + " for: " + ci.getName());
204+
Asserts.assertFalse(ci.containsVerification(pattern), "Found unexpected verification pattern " + pattern + " for: " + ci.getName() + "\n" + data);
205205
}
206206
}
207207

0 commit comments

Comments
 (0)