Skip to content

Commit 0b0f83c

Browse files
committed
8345220: Serial: Refactor TenuredGeneration::promotion_attempt_is_safe
Reviewed-by: tschatzl, mli
1 parent dfcbfb5 commit 0b0f83c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/hotspot/share/gc/serial/tenuredGeneration.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,14 @@ void TenuredGeneration::update_counters() {
378378

379379
bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
380380
size_t available = _the_space->free() + _virtual_space.uncommitted_size();
381-
size_t av_promo = (size_t)_avg_promoted->padded_average();
382-
bool res = (available >= av_promo) || (available >= max_promotion_in_bytes);
381+
382+
size_t avg_promoted = (size_t)_avg_promoted->padded_average();
383+
size_t promotion_estimate = MIN2(avg_promoted, max_promotion_in_bytes);
384+
385+
bool res = (promotion_estimate <= available);
383386

384387
log_trace(gc)("Tenured: promo attempt is%s safe: available(" SIZE_FORMAT ") %s av_promo(" SIZE_FORMAT "), max_promo(" SIZE_FORMAT ")",
385-
res? "":" not", available, res? ">=":"<", av_promo, max_promotion_in_bytes);
388+
res? "":" not", available, res? ">=":"<", avg_promoted, max_promotion_in_bytes);
386389

387390
return res;
388391
}

0 commit comments

Comments
 (0)