Skip to content

Commit af07919

Browse files
author
Thomas Schatzl
committedMay 17, 2022
8286729: G1: Calculation to fit in optional region in remaining pause time wrong
Reviewed-by: iwalulya, lkorinth
1 parent c0d51d4 commit af07919

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -1393,13 +1393,13 @@ void G1Policy::calculate_optional_collection_set_regions(G1CollectionSetCandidat
13931393
assert(_g1h->collector_state()->in_mixed_phase(), "Should only be called in mixed phase");
13941394

13951395
num_optional_regions = 0;
1396-
double prediction_ms = 0;
1396+
double total_prediction_ms = 0.0;
13971397
uint candidate_idx = candidates->cur_idx();
13981398

13991399
HeapRegion* r = candidates->at(candidate_idx);
14001400
while (num_optional_regions < max_optional_regions) {
14011401
assert(r != NULL, "Region must exist");
1402-
prediction_ms += predict_region_total_time_ms(r, false);
1402+
double prediction_ms = predict_region_total_time_ms(r, false);
14031403

14041404
if (prediction_ms > time_remaining_ms) {
14051405
log_debug(gc, ergo, cset)("Prediction %.3fms for region %u does not fit remaining time: %.3fms.",
@@ -1408,13 +1408,14 @@ void G1Policy::calculate_optional_collection_set_regions(G1CollectionSetCandidat
14081408
}
14091409
// This region will be included in the next optional evacuation.
14101410

1411+
total_prediction_ms += prediction_ms;
14111412
time_remaining_ms -= prediction_ms;
14121413
num_optional_regions++;
14131414
r = candidates->at(++candidate_idx);
14141415
}
14151416

1416-
log_debug(gc, ergo, cset)("Prepared %u regions out of %u for optional evacuation. Predicted time: %.3fms",
1417-
num_optional_regions, max_optional_regions, prediction_ms);
1417+
log_debug(gc, ergo, cset)("Prepared %u regions out of %u for optional evacuation. Total predicted time: %.3fms",
1418+
num_optional_regions, max_optional_regions, total_prediction_ms);
14181419
}
14191420

14201421
// Number of regions required to store the given number of bytes, taking

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on May 17, 2022

@openjdk-notifier[bot]
Please sign in to comment.