Skip to content

Commit 50f9a70

Browse files
JSNORDSTThomas Schatzl
JSNORDST
authored and
Thomas Schatzl
committed
8217327: G1 Post-Cleanup region liveness printing should not print out-of-date efficiency
Reviewed-by: tschatzl, sjohanss
1 parent e963ebd commit 50f9a70

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

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

+25-16
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#include "runtime/prefetch.inline.hpp"
7070
#include "services/memTracker.hpp"
7171
#include "utilities/align.hpp"
72+
#include "utilities/formatBuffer.hpp"
7273
#include "utilities/growableArray.hpp"
7374

7475
bool G1CMBitMapClosure::do_addr(HeapWord* const addr) {
@@ -2890,8 +2891,9 @@ G1CMTask::G1CMTask(uint worker_id,
28902891
#define G1PPRL_STATE_H_FORMAT " %5s"
28912892
#define G1PPRL_BYTE_FORMAT " " SIZE_FORMAT_W(9)
28922893
#define G1PPRL_BYTE_H_FORMAT " %9s"
2893-
#define G1PPRL_DOUBLE_FORMAT " %14.1f"
2894-
#define G1PPRL_DOUBLE_H_FORMAT " %14s"
2894+
#define G1PPRL_DOUBLE_FORMAT "%14.1f"
2895+
#define G1PPRL_GCEFF_FORMAT " %14s"
2896+
#define G1PPRL_GCEFF_H_FORMAT " %14s"
28952897

28962898
// For summary info
28972899
#define G1PPRL_SUM_ADDR_FORMAT(tag) " " tag ":" G1PPRL_ADDR_BASE_FORMAT
@@ -2926,7 +2928,7 @@ G1PrintRegionLivenessInfoClosure::G1PrintRegionLivenessInfoClosure(const char* p
29262928
G1PPRL_BYTE_H_FORMAT
29272929
G1PPRL_BYTE_H_FORMAT
29282930
G1PPRL_BYTE_H_FORMAT
2929-
G1PPRL_DOUBLE_H_FORMAT
2931+
G1PPRL_GCEFF_H_FORMAT
29302932
G1PPRL_BYTE_H_FORMAT
29312933
G1PPRL_STATE_H_FORMAT
29322934
G1PPRL_BYTE_H_FORMAT,
@@ -2939,7 +2941,7 @@ G1PrintRegionLivenessInfoClosure::G1PrintRegionLivenessInfoClosure(const char* p
29392941
G1PPRL_BYTE_H_FORMAT
29402942
G1PPRL_BYTE_H_FORMAT
29412943
G1PPRL_BYTE_H_FORMAT
2942-
G1PPRL_DOUBLE_H_FORMAT
2944+
G1PPRL_GCEFF_H_FORMAT
29432945
G1PPRL_BYTE_H_FORMAT
29442946
G1PPRL_STATE_H_FORMAT
29452947
G1PPRL_BYTE_H_FORMAT,
@@ -2964,6 +2966,7 @@ bool G1PrintRegionLivenessInfoClosure::do_heap_region(HeapRegion* r) {
29642966
size_t remset_bytes = r->rem_set()->mem_size();
29652967
size_t strong_code_roots_bytes = r->rem_set()->strong_code_roots_mem_size();
29662968
const char* remset_type = r->rem_set()->get_short_state_str();
2969+
FormatBuffer<16> gc_efficiency("");
29672970

29682971
_total_used_bytes += used_bytes;
29692972
_total_capacity_bytes += capacity_bytes;
@@ -2972,20 +2975,26 @@ bool G1PrintRegionLivenessInfoClosure::do_heap_region(HeapRegion* r) {
29722975
_total_remset_bytes += remset_bytes;
29732976
_total_strong_code_roots_bytes += strong_code_roots_bytes;
29742977

2978+
if(gc_eff < 0) {
2979+
gc_efficiency.append("-");
2980+
} else {
2981+
gc_efficiency.append(G1PPRL_DOUBLE_FORMAT, gc_eff);
2982+
}
2983+
29752984
// Print a line for this particular region.
29762985
log_trace(gc, liveness)(G1PPRL_LINE_PREFIX
2977-
G1PPRL_TYPE_FORMAT
2978-
G1PPRL_ADDR_BASE_FORMAT
2979-
G1PPRL_BYTE_FORMAT
2980-
G1PPRL_BYTE_FORMAT
2981-
G1PPRL_BYTE_FORMAT
2982-
G1PPRL_DOUBLE_FORMAT
2983-
G1PPRL_BYTE_FORMAT
2984-
G1PPRL_STATE_FORMAT
2985-
G1PPRL_BYTE_FORMAT,
2986-
type, p2i(bottom), p2i(end),
2987-
used_bytes, prev_live_bytes, next_live_bytes, gc_eff,
2988-
remset_bytes, remset_type, strong_code_roots_bytes);
2986+
G1PPRL_TYPE_FORMAT
2987+
G1PPRL_ADDR_BASE_FORMAT
2988+
G1PPRL_BYTE_FORMAT
2989+
G1PPRL_BYTE_FORMAT
2990+
G1PPRL_BYTE_FORMAT
2991+
G1PPRL_GCEFF_FORMAT
2992+
G1PPRL_BYTE_FORMAT
2993+
G1PPRL_STATE_FORMAT
2994+
G1PPRL_BYTE_FORMAT,
2995+
type, p2i(bottom), p2i(end),
2996+
used_bytes, prev_live_bytes, next_live_bytes, gc_efficiency.buffer(),
2997+
remset_bytes, remset_type, strong_code_roots_bytes);
29892998

29902999
return false;
29913000
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -139,7 +139,7 @@ void HeapRegion::hr_clear(bool clear_space) {
139139
if (clear_space) clear(SpaceDecorator::Mangle);
140140

141141
_evacuation_failed = false;
142-
_gc_efficiency = 0.0;
142+
_gc_efficiency = -1.0;
143143
}
144144

145145
void HeapRegion::clear_cardtable() {
@@ -255,7 +255,7 @@ HeapRegion::HeapRegion(uint hrm_index,
255255
_prev_top_at_mark_start(NULL), _next_top_at_mark_start(NULL),
256256
_prev_marked_bytes(0), _next_marked_bytes(0),
257257
_young_index_in_cset(-1),
258-
_surv_rate_group(NULL), _age_index(G1SurvRateGroup::InvalidAgeIndex), _gc_efficiency(0.0),
258+
_surv_rate_group(NULL), _age_index(G1SurvRateGroup::InvalidAgeIndex), _gc_efficiency(-1.0),
259259
_node_index(G1NUMA::UnknownNodeIndex)
260260
{
261261
assert(Universe::on_page_boundary(mr.start()) && Universe::on_page_boundary(mr.end()),

src/hotspot/share/gc/g1/heapRegion.inline.hpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* 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,
268268
inline void HeapRegion::note_start_of_marking() {
269269
_next_marked_bytes = 0;
270270
_next_top_at_mark_start = top();
271+
_gc_efficiency = -1.0;
271272
}
272273

273274
inline void HeapRegion::note_end_of_marking() {

0 commit comments

Comments
 (0)