< prev index next >

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

Print this page
rev 53416 : imported patch 8217330-split-collectionsetchooser
rev 53417 : [mq]: 8217330-leo-review

*** 1,7 **** /* ! * Copyright (c) 2001, 2018, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2019, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 21,30 **** --- 21,31 ---- * questions. * */ #include "precompiled.hpp" + #include "gc/g1/collectionSetChooser.hpp" #include "gc/g1/g1Analytics.hpp" #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1CollectionSet.hpp" #include "gc/g1/g1ConcurrentMark.hpp" #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
*** 436,446 **** void G1Policy::record_full_collection_start() { _full_collection_start_sec = os::elapsedTime(); // Release the future to-space so that it is available for compaction into. collector_state()->set_in_young_only_phase(false); collector_state()->set_in_full_gc(true); ! cset_chooser()->clear(); } void G1Policy::record_full_collection_end() { // Consider this like a collection pause for the purposes of allocation // since last pause. --- 437,447 ---- void G1Policy::record_full_collection_start() { _full_collection_start_sec = os::elapsedTime(); // Release the future to-space so that it is available for compaction into. collector_state()->set_in_young_only_phase(false); collector_state()->set_in_full_gc(true); ! _collection_set->clear_candidates(); } void G1Policy::record_full_collection_end() { // Consider this like a collection pause for the purposes of allocation // since last pause.
*** 544,557 **** double G1Policy::constant_other_time_ms(double pause_time_ms) const { return other_time_ms(pause_time_ms) - phase_times()->total_free_cset_time_ms(); } - CollectionSetChooser* G1Policy::cset_chooser() const { - return _collection_set->cset_chooser(); - } - bool G1Policy::about_to_start_mixed_phase() const { return _g1h->concurrent_mark()->cm_thread()->during_cycle() || collector_state()->in_young_gc_before_mixed(); } bool G1Policy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) { --- 545,554 ----
*** 771,782 **** update_rs_time_goal_ms -= scan_hcc_time_ms; } _g1h->concurrent_refine()->adjust(average_time_ms(G1GCPhaseTimes::UpdateRS), phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), update_rs_time_goal_ms); - - cset_chooser()->verify(); } G1IHOPControl* G1Policy::create_ihop_control(const G1Predictions* predictor){ if (G1UseAdaptiveIHOP) { return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent, --- 768,777 ----
*** 1030,1040 **** } } } void G1Policy::record_concurrent_mark_cleanup_end() { ! cset_chooser()->rebuild(_g1h->workers(), _g1h->num_regions()); bool mixed_gc_pending = next_gc_should_be_mixed("request mixed gcs", "request young-only gcs"); if (!mixed_gc_pending) { clear_collection_set_candidates(); abort_time_to_mixed_tracking(); --- 1025,1036 ---- } } } void G1Policy::record_concurrent_mark_cleanup_end() { ! G1CollectionSetCandidates* candidates = CollectionSetChooser::build(_g1h->workers(), _g1h->num_regions()); ! _collection_set->set_candidates(candidates); bool mixed_gc_pending = next_gc_should_be_mixed("request mixed gcs", "request young-only gcs"); if (!mixed_gc_pending) { clear_collection_set_candidates(); abort_time_to_mixed_tracking();
*** 1061,1074 **** } }; void G1Policy::clear_collection_set_candidates() { // Clear remembered sets of remaining candidate regions and the actual candidate ! // list. G1ClearCollectionSetCandidateRemSets cl; ! cset_chooser()->iterate(&cl); ! cset_chooser()->clear(); } void G1Policy::maybe_start_marking() { if (need_to_start_conc_mark("end of GC")) { // Note: this might have already been set, if during the last --- 1057,1070 ---- } }; void G1Policy::clear_collection_set_candidates() { // Clear remembered sets of remaining candidate regions and the actual candidate ! // set. G1ClearCollectionSetCandidateRemSets cl; ! _collection_set->candidates()->iterate(&cl); ! _collection_set->clear_candidates(); } void G1Policy::maybe_start_marking() { if (need_to_start_conc_mark("end of GC")) { // Note: this might have already been set, if during the last
*** 1130,1155 **** _initial_mark_to_mixed.reset(); } bool G1Policy::next_gc_should_be_mixed(const char* true_action_str, const char* false_action_str) const { ! if (cset_chooser()->is_empty()) { log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str); return false; } // Is the amount of uncollected reclaimable space above G1HeapWastePercent? ! size_t reclaimable_bytes = cset_chooser()->remaining_reclaimable_bytes(); double reclaimable_percent = reclaimable_bytes_percent(reclaimable_bytes); double threshold = (double) G1HeapWastePercent; if (reclaimable_percent <= threshold) { log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, ! false_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent); return false; } log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, ! true_action_str, cset_chooser()->remaining_regions(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent); return true; } uint G1Policy::calc_min_old_cset_length() const { // The min old CSet region bound is based on the maximum desired --- 1126,1153 ---- _initial_mark_to_mixed.reset(); } bool G1Policy::next_gc_should_be_mixed(const char* true_action_str, const char* false_action_str) const { ! G1CollectionSetCandidates* candidates = _collection_set->candidates(); ! ! if (candidates->is_empty()) { log_debug(gc, ergo)("%s (candidate old regions not available)", false_action_str); return false; } // Is the amount of uncollected reclaimable space above G1HeapWastePercent? ! size_t reclaimable_bytes = candidates->remaining_reclaimable_bytes(); double reclaimable_percent = reclaimable_bytes_percent(reclaimable_bytes); double threshold = (double) G1HeapWastePercent; if (reclaimable_percent <= threshold) { log_debug(gc, ergo)("%s (reclaimable percentage not over threshold). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, ! false_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent); return false; } log_debug(gc, ergo)("%s (candidate old regions available). candidate old regions: %u reclaimable: " SIZE_FORMAT " (%1.2f) threshold: " UINTX_FORMAT, ! true_action_str, candidates->num_remaining(), reclaimable_bytes, reclaimable_percent, G1HeapWastePercent); return true; } uint G1Policy::calc_min_old_cset_length() const { // The min old CSet region bound is based on the maximum desired
*** 1157,1170 **** // look expensive, we should add them to the CSet anyway to make // sure we go through the available old regions in no more than the // maximum desired number of mixed GCs. // // The calculation is based on the number of marked regions we added ! // to the CSet chooser in the first place, not how many remain, so // that the result is the same during all mixed GCs that follow a cycle. ! const size_t region_num = (size_t) cset_chooser()->length(); const size_t gc_num = (size_t) MAX2(G1MixedGCCountTarget, (uintx) 1); size_t result = region_num / gc_num; // emulate ceiling if (result * gc_num < region_num) { result += 1; --- 1155,1168 ---- // look expensive, we should add them to the CSet anyway to make // sure we go through the available old regions in no more than the // maximum desired number of mixed GCs. // // The calculation is based on the number of marked regions we added ! // to the CSet candidates in the first place, not how many remain, so // that the result is the same during all mixed GCs that follow a cycle. ! const size_t region_num = _collection_set->candidates()->num_regions(); const size_t gc_num = (size_t) MAX2(G1MixedGCCountTarget, (uintx) 1); size_t result = region_num / gc_num; // emulate ceiling if (result * gc_num < region_num) { result += 1;
< prev index next >