8217327: G1 Post-Cleanup region liveness printing should not print out-of-date efficiency

Reviewed-by: tschatzl, sjohanss
This commit is contained in:
JSNORDST 2021-02-01 18:19:43 +00:00 committed by Thomas Schatzl
parent e963ebd721
commit 50f9a70f0d
3 changed files with 30 additions and 20 deletions

View File

@ -69,6 +69,7 @@
#include "runtime/prefetch.inline.hpp"
#include "services/memTracker.hpp"
#include "utilities/align.hpp"
#include "utilities/formatBuffer.hpp"
#include "utilities/growableArray.hpp"
bool G1CMBitMapClosure::do_addr(HeapWord* const addr) {
@ -2890,8 +2891,9 @@ G1CMTask::G1CMTask(uint worker_id,
#define G1PPRL_STATE_H_FORMAT " %5s"
#define G1PPRL_BYTE_FORMAT " " SIZE_FORMAT_W(9)
#define G1PPRL_BYTE_H_FORMAT " %9s"
#define G1PPRL_DOUBLE_FORMAT " %14.1f"
#define G1PPRL_DOUBLE_H_FORMAT " %14s"
#define G1PPRL_DOUBLE_FORMAT "%14.1f"
#define G1PPRL_GCEFF_FORMAT " %14s"
#define G1PPRL_GCEFF_H_FORMAT " %14s"
// For summary info
#define G1PPRL_SUM_ADDR_FORMAT(tag) " " tag ":" G1PPRL_ADDR_BASE_FORMAT
@ -2926,7 +2928,7 @@ G1PrintRegionLivenessInfoClosure::G1PrintRegionLivenessInfoClosure(const char* p
G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_DOUBLE_H_FORMAT
G1PPRL_GCEFF_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_STATE_H_FORMAT
G1PPRL_BYTE_H_FORMAT,
@ -2939,7 +2941,7 @@ G1PrintRegionLivenessInfoClosure::G1PrintRegionLivenessInfoClosure(const char* p
G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_DOUBLE_H_FORMAT
G1PPRL_GCEFF_H_FORMAT
G1PPRL_BYTE_H_FORMAT
G1PPRL_STATE_H_FORMAT
G1PPRL_BYTE_H_FORMAT,
@ -2964,6 +2966,7 @@ bool G1PrintRegionLivenessInfoClosure::do_heap_region(HeapRegion* r) {
size_t remset_bytes = r->rem_set()->mem_size();
size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size();
const char* remset_type = r->rem_set()->get_short_state_str();
FormatBuffer<16> gc_efficiency("");
_total_used_bytes += used_bytes;
_total_capacity_bytes += capacity_bytes;
@ -2972,20 +2975,26 @@ bool G1PrintRegionLivenessInfoClosure::do_heap_region(HeapRegion* r) {
_total_remset_bytes += remset_bytes;
_total_strong_code_roots_bytes += strong_code_roots_bytes;
if(gc_eff < 0) {
gc_efficiency.append("-");
} else {
gc_efficiency.append(G1PPRL_DOUBLE_FORMAT, gc_eff);
}
// Print a line for this particular region.
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
G1PPRL_TYPE_FORMAT
G1PPRL_ADDR_BASE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_DOUBLE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_STATE_FORMAT
G1PPRL_BYTE_FORMAT,
type, p2i(bottom), p2i(end),
used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
remset_bytes, remset_type, strong_code_roots_bytes);
G1PPRL_TYPE_FORMAT
G1PPRL_ADDR_BASE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_GCEFF_FORMAT
G1PPRL_BYTE_FORMAT
G1PPRL_STATE_FORMAT
G1PPRL_BYTE_FORMAT,
type, p2i(bottom), p2i(end),
used_bytes, prev_live_bytes, next_live_bytes, gc_efficiency.buffer(),
remset_bytes, remset_type, strong_code_roots_bytes);
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -139,7 +139,7 @@ void HeapRegion::hr_clear(bool clear_space) {
if (clear_space) clear(SpaceDecorator::Mangle);
_evacuation_failed = false;
_gc_efficiency = 0.0;
_gc_efficiency = -1.0;
}
void HeapRegion::clear_cardtable() {
@ -255,7 +255,7 @@ HeapRegion::HeapRegion(uint hrm_index,
_prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
_prev_marked_bytes(0), _next_marked_bytes(0),
_young_index_in_cset(-1),
_surv_rate_group(NULL), _age_index(G1SurvRateGroup::InvalidAgeIndex), _gc_efficiency(0.0),
_surv_rate_group(NULL), _age_index(G1SurvRateGroup::InvalidAgeIndex), _gc_efficiency(-1.0),
_node_index(G1NUMA::UnknownNodeIndex)
{
assert(Universe::on_page_boundary(mr.start()) && Universe::on_page_boundary(mr.end()),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2021, 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
@ -268,6 +268,7 @@ inline HeapWord* HeapRegion::allocate_no_bot_updates(size_t min_word_size,
inline void HeapRegion::note_start_of_marking() {
_next_marked_bytes = 0;
_next_top_at_mark_start = top();
_gc_efficiency = -1.0;
}
inline void HeapRegion::note_end_of_marking() {