Skip to content

Commit 73ba7fd

Browse files
author
Thomas Schatzl
committedMay 30, 2022
8287157: Clean up G1Policy::next_gc_should_be_mixed()
Reviewed-by: lkorinth
1 parent b1b9674 commit 73ba7fd

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed
 

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
683683
} else if (G1GCPauseTypeHelper::is_mixed_pause(this_pause)) {
684684
// This is a mixed GC. Here we decide whether to continue doing more
685685
// mixed GCs or not.
686-
if (!next_gc_should_be_mixed("continue mixed GCs",
687-
"do not continue mixed GCs")) {
686+
if (!next_gc_should_be_mixed("do not continue mixed GCs")) {
688687
collector_state()->set_in_young_only_phase(true);
689688

690689
clear_collection_set_candidates();
@@ -1125,7 +1124,7 @@ void G1Policy::record_concurrent_mark_cleanup_end(bool has_rebuilt_remembered_se
11251124
if (has_rebuilt_remembered_sets) {
11261125
G1CollectionSetCandidates* candidates = G1CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions());
11271126
_collection_set->set_candidates(candidates);
1128-
mixed_gc_pending = next_gc_should_be_mixed("request mixed gcs", "request young-only gcs");
1127+
mixed_gc_pending = next_gc_should_be_mixed("request young-only gcs");
11291128
}
11301129

11311130
if (log_is_enabled(Trace, gc, liveness)) {
@@ -1248,16 +1247,16 @@ void G1Policy::abort_time_to_mixed_tracking() {
12481247
_concurrent_start_to_mixed.reset();
12491248
}
12501249

1251-
bool G1Policy::next_gc_should_be_mixed(const char* true_action_str,
1252-
const char* false_action_str) const {
1250+
bool G1Policy::next_gc_should_be_mixed(const char* no_candidates_str) const {
12531251
G1CollectionSetCandidates* candidates = _collection_set->candidates();
12541252

12551253
if (candidates == NULL || candidates->is_empty()) {
1256-
log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str);
1254+
log_debug(gc, ergo)("%s (candidate old regions not available)", no_candidates_str);
12571255
return false;
12581256
}
1259-
// Go through all regions - we already pruned regions not worth collecting
1260-
// during candidate selection.
1257+
// Otherwise always continue mixed collection. There is no other reason to stop the
1258+
// mixed phase than there are no more candidates. All candidates not pruned earlier
1259+
// during candidate selection are worth collecting.
12611260
return true;
12621261
}
12631262

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ class G1Policy: public CHeapObj<mtGC> {
331331
void record_concurrent_mark_cleanup_start();
332332
void record_concurrent_mark_cleanup_end(bool has_rebuilt_remembered_sets);
333333

334-
bool next_gc_should_be_mixed(const char* true_action_str,
335-
const char* false_action_str) const;
334+
bool next_gc_should_be_mixed(const char* no_candidates_str) const;
336335

337336
// Amount of allowed waste in bytes in the collection set.
338337
size_t allowed_waste_in_collection_set() const;

0 commit comments

Comments
 (0)
Please sign in to comment.