From 3be5758bb413fb6b4dc6191d78ca38332d5153f1 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 24 Jan 2023 17:33:35 +0000 Subject: [PATCH] 8300769: Remove G1CollectionSet::_inc_bytes_used_before Reviewed-by: ayang, iwalulya --- src/hotspot/share/gc/g1/g1CollectionSet.cpp | 29 +------------------ src/hotspot/share/gc/g1/g1CollectionSet.hpp | 22 -------------- src/hotspot/share/gc/g1/g1Policy.cpp | 7 ++--- src/hotspot/share/gc/g1/g1YoungCollector.cpp | 1 - .../gc/g1/g1YoungGCPostEvacuateTasks.cpp | 1 + 5 files changed, 5 insertions(+), 55 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index a6bbca73709..a3c6446ebb9 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -59,10 +59,8 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) : _collection_set_cur_length(0), _collection_set_max_length(0), _num_optional_regions(0), - _bytes_used_before(0), _inc_build_state(Inactive), - _inc_part_start(0), - _inc_bytes_used_before(0) { + _inc_part_start(0) { } G1CollectionSet::~G1CollectionSet() { @@ -114,7 +112,6 @@ void G1CollectionSet::add_old_region(HeapRegion* hr) { assert(_collection_set_cur_length < _collection_set_max_length, "Collection set now larger than maximum size."); _collection_set_regions[_collection_set_cur_length++] = hr->hrm_index(); - _bytes_used_before += hr->used(); _old_region_length++; _g1h->old_set_remove(hr); @@ -133,8 +130,6 @@ void G1CollectionSet::start_incremental_building() { assert(_collection_set_cur_length == 0, "Collection set must be empty before starting a new collection set."); assert(_inc_build_state == Inactive, "Precondition"); - _inc_bytes_used_before = 0; - update_incremental_marker(); } @@ -200,26 +195,6 @@ void G1CollectionSet::add_young_region_common(HeapRegion* hr) { assert(hr->is_young(), "invariant"); assert(_inc_build_state == Active, "Precondition"); - // This routine is used when: - // * adding survivor regions to the incremental cset at the end of an - // evacuation pause or - // * adding the current allocation region to the incremental cset - // when it is retired. - // Therefore this routine may be called at a safepoint by the - // VM thread, or in-between safepoints by mutator threads (when - // retiring the current allocation region) - // We need to clear and set the cached recorded/cached collection set - // information in the heap region here (before the region gets added - // to the collection set). An individual heap region's cached values - // are calculated, aggregated with the policy collection set info, - // and cached in the heap region here (initially) and (subsequently) - // by the Young List sampling code. - // Ignore calls to this due to retirement during full gc. - - if (!_g1h->collector_state()->in_full_gc()) { - _inc_bytes_used_before += hr->used(); - } - assert(!hr->in_collection_set(), "invariant"); _g1h->register_young_region_with_region_attr(hr); @@ -334,8 +309,6 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi verify_young_cset_indices(); - _bytes_used_before = _inc_bytes_used_before; - double predicted_base_time_ms = _policy->predict_base_time_ms(pending_cards); // Base time already includes the whole remembered set related time, so do not add that here // again. diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.hpp b/src/hotspot/share/gc/g1/g1CollectionSet.hpp index 90fe22a2021..e62a39d1d02 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.hpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.hpp @@ -156,11 +156,6 @@ class G1CollectionSet { // correspond to the first x entries in the collection set candidates. uint _num_optional_regions; - // The number of bytes in the collection set before the pause. Set from - // the incrementally built collection set at the start of an evacuation - // pause, and updated as more regions are added to the collection set. - size_t _bytes_used_before; - enum CSetBuildType { Active, // We are actively building the collection set Inactive // We are not actively building the collection set @@ -169,15 +164,6 @@ class G1CollectionSet { CSetBuildType _inc_build_state; size_t _inc_part_start; - // The associated information that is maintained while the incremental - // collection set is being built with *young* regions. Used to populate - // the recorded info for the evacuation pause. - - // The number of bytes in the incrementally built collection set. - // Used to set _collection_set_bytes_used_before at the start of - // an evacuation pause. - size_t _inc_bytes_used_before; - G1CollectorState* collector_state() const; G1GCPhaseTimes* phase_times(); @@ -273,14 +259,6 @@ public: void iterate_optional(HeapRegionClosure* cl) const; - size_t bytes_used_before() const { - return _bytes_used_before; - } - - void reset_bytes_used_before() { - _bytes_used_before = 0; - } - // Finalize the initial collection set consisting of all young regions potentially a // few old gen regions. void finalize_initial_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor); diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index f7940445503..a3ee1e04819 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -103,8 +103,9 @@ void G1Policy::init(G1CollectedHeap* g1h, G1CollectionSet* collection_set) { _free_regions_at_end_of_collection = _g1h->num_free_regions(); update_young_length_bounds(); - // We may immediately start allocating regions and placing them on the - // collection set list. Initialize the per-collection set info + + // We immediately start allocating regions placing them in the collection set. + // Initialize the collection set info. _collection_set->start_incremental_building(); } @@ -638,8 +639,6 @@ void G1Policy::record_young_collection_start() { phase_times()->record_cur_collection_start_sec(now.seconds()); - _collection_set->reset_bytes_used_before(); - // do that for any other surv rate groups _eden_surv_rate_group->stop_adding_regions(); _survivors_age_table.clear(); diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index 9302f1180da..37659776d1b 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.cpp @@ -1020,7 +1020,6 @@ void G1YoungCollector::post_evacuate_collection_set(G1EvacInfo* evacuation_info, _g1h->record_obj_copy_mem_stats(); - evacuation_info->set_collection_set_used_before(collection_set()->bytes_used_before()); evacuation_info->set_bytes_used(_g1h->bytes_used_during_gc()); _g1h->start_new_collection_set(); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 5cbbebe4ed2..87ecb5819ad 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -465,6 +465,7 @@ public: void report(G1CollectedHeap* g1h, G1EvacInfo* evacuation_info) { evacuation_info->set_regions_freed(_regions_freed); + evacuation_info->set_collection_set_used_before(_before_used_bytes + _after_used_bytes); evacuation_info->increment_collection_set_used_after(_after_used_bytes); g1h->decrement_summary_bytes(_before_used_bytes);