annotate src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp @ 13059:46d7652b223c

8026853: Prepare GC code for collector policy regression fix Summary: Cleanup related to the NewSize and MaxNewSize bugs Reviewed-by: tschatzl, jcoomes, ehelin
author jwilhelm
date Mon, 21 Oct 2013 18:56:20 +0200
parents c49c7f835e8d
children 8f07aa079343
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1387
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1387
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1387
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #include "gc_implementation/parallelScavenge/psAdaptiveSizePolicy.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "gc_implementation/parallelScavenge/psGCAdaptivePolicyCounters.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "gc_implementation/shared/gcPolicyCounters.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "gc_interface/gcCause.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "memory/collectorPolicy.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "runtime/timer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "utilities/top.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 #include <math.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 PSAdaptiveSizePolicy::PSAdaptiveSizePolicy(size_t init_eden_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
38 size_t init_promo_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
39 size_t init_survivor_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
40 size_t intra_generation_alignment,
a61af66fc99e Initial load
duke
parents:
diff changeset
41 double gc_pause_goal_sec,
a61af66fc99e Initial load
duke
parents:
diff changeset
42 double gc_minor_pause_goal_sec,
a61af66fc99e Initial load
duke
parents:
diff changeset
43 uint gc_cost_ratio) :
a61af66fc99e Initial load
duke
parents:
diff changeset
44 AdaptiveSizePolicy(init_eden_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
45 init_promo_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
46 init_survivor_size,
a61af66fc99e Initial load
duke
parents:
diff changeset
47 gc_pause_goal_sec,
a61af66fc99e Initial load
duke
parents:
diff changeset
48 gc_cost_ratio),
13059
46d7652b223c 8026853: Prepare GC code for collector policy regression fix
jwilhelm
parents: 12351
diff changeset
49 _collection_cost_margin_fraction(AdaptiveSizePolicyCollectionCostMargin / 100.0),
0
a61af66fc99e Initial load
duke
parents:
diff changeset
50 _intra_generation_alignment(intra_generation_alignment),
a61af66fc99e Initial load
duke
parents:
diff changeset
51 _live_at_last_full_gc(init_promo_size),
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _gc_minor_pause_goal_sec(gc_minor_pause_goal_sec),
a61af66fc99e Initial load
duke
parents:
diff changeset
53 _latest_major_mutator_interval_seconds(0),
a61af66fc99e Initial load
duke
parents:
diff changeset
54 _young_gen_change_for_major_pause_count(0)
a61af66fc99e Initial load
duke
parents:
diff changeset
55 {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // Sizing policy statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _avg_major_pause =
a61af66fc99e Initial load
duke
parents:
diff changeset
58 new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
a61af66fc99e Initial load
duke
parents:
diff changeset
59 _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
60 _avg_major_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 _avg_base_footprint = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
63 _major_pause_old_estimator =
a61af66fc99e Initial load
duke
parents:
diff changeset
64 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
65 _major_pause_young_estimator =
a61af66fc99e Initial load
duke
parents:
diff changeset
66 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 _major_collection_estimator =
a61af66fc99e Initial load
duke
parents:
diff changeset
68 new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 _young_gen_size_increment_supplement = YoungGenerationSizeSupplement;
a61af66fc99e Initial load
duke
parents:
diff changeset
71 _old_gen_size_increment_supplement = TenuredGenerationSizeSupplement;
a61af66fc99e Initial load
duke
parents:
diff changeset
72
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // Start the timers
a61af66fc99e Initial load
duke
parents:
diff changeset
74 _major_timer.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 _old_gen_policy_is_ready = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
77 }
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79 void PSAdaptiveSizePolicy::major_collection_begin() {
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Update the interval time
a61af66fc99e Initial load
duke
parents:
diff changeset
81 _major_timer.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Save most recent collection time
a61af66fc99e Initial load
duke
parents:
diff changeset
83 _latest_major_mutator_interval_seconds = _major_timer.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
84 _major_timer.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
85 _major_timer.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 void PSAdaptiveSizePolicy::update_minor_pause_old_estimator(
a61af66fc99e Initial load
duke
parents:
diff changeset
89 double minor_pause_in_ms) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 double promo_size_in_mbytes = ((double)_promo_size)/((double)M);
a61af66fc99e Initial load
duke
parents:
diff changeset
91 _minor_pause_old_estimator->update(promo_size_in_mbytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 minor_pause_in_ms);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 void PSAdaptiveSizePolicy::major_collection_end(size_t amount_live,
a61af66fc99e Initial load
duke
parents:
diff changeset
96 GCCause::Cause gc_cause) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Update the pause time.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 _major_timer.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (gc_cause != GCCause::_java_lang_system_gc ||
a61af66fc99e Initial load
duke
parents:
diff changeset
101 UseAdaptiveSizePolicyWithSystemGC) {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 double major_pause_in_seconds = _major_timer.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
103 double major_pause_in_ms = major_pause_in_seconds * MILLIUNITS;
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Sample for performance counter
a61af66fc99e Initial load
duke
parents:
diff changeset
106 _avg_major_pause->sample(major_pause_in_seconds);
a61af66fc99e Initial load
duke
parents:
diff changeset
107
a61af66fc99e Initial load
duke
parents:
diff changeset
108 // Cost of collection (unit-less)
a61af66fc99e Initial load
duke
parents:
diff changeset
109 double collection_cost = 0.0;
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if ((_latest_major_mutator_interval_seconds > 0.0) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
111 (major_pause_in_seconds > 0.0)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 double interval_in_seconds =
a61af66fc99e Initial load
duke
parents:
diff changeset
113 _latest_major_mutator_interval_seconds + major_pause_in_seconds;
a61af66fc99e Initial load
duke
parents:
diff changeset
114 collection_cost =
a61af66fc99e Initial load
duke
parents:
diff changeset
115 major_pause_in_seconds / interval_in_seconds;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 avg_major_gc_cost()->sample(collection_cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 // Sample for performance counter
a61af66fc99e Initial load
duke
parents:
diff changeset
119 _avg_major_interval->sample(interval_in_seconds);
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // Calculate variables used to estimate pause time vs. gen sizes
a61af66fc99e Initial load
duke
parents:
diff changeset
123 double eden_size_in_mbytes = ((double)_eden_size)/((double)M);
a61af66fc99e Initial load
duke
parents:
diff changeset
124 double promo_size_in_mbytes = ((double)_promo_size)/((double)M);
a61af66fc99e Initial load
duke
parents:
diff changeset
125 _major_pause_old_estimator->update(promo_size_in_mbytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
126 major_pause_in_ms);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 _major_pause_young_estimator->update(eden_size_in_mbytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
128 major_pause_in_ms);
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 gclog_or_tty->print("psAdaptiveSizePolicy::major_collection_end: "
a61af66fc99e Initial load
duke
parents:
diff changeset
132 "major gc cost: %f average: %f", collection_cost,
a61af66fc99e Initial load
duke
parents:
diff changeset
133 avg_major_gc_cost()->average());
a61af66fc99e Initial load
duke
parents:
diff changeset
134 gclog_or_tty->print_cr(" major pause: %f major period %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
135 major_pause_in_ms,
a61af66fc99e Initial load
duke
parents:
diff changeset
136 _latest_major_mutator_interval_seconds * MILLIUNITS);
a61af66fc99e Initial load
duke
parents:
diff changeset
137 }
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // Calculate variable used to estimate collection cost vs. gen sizes
a61af66fc99e Initial load
duke
parents:
diff changeset
140 assert(collection_cost >= 0.0, "Expected to be non-negative");
a61af66fc99e Initial load
duke
parents:
diff changeset
141 _major_collection_estimator->update(promo_size_in_mbytes,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 collection_cost);
a61af66fc99e Initial load
duke
parents:
diff changeset
143 }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // Update the amount live at the end of a full GC
a61af66fc99e Initial load
duke
parents:
diff changeset
146 _live_at_last_full_gc = amount_live;
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // The policy does not have enough data until at least some major collections
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // have been done.
a61af66fc99e Initial load
duke
parents:
diff changeset
150 if (_avg_major_pause->count() >= AdaptiveSizePolicyReadyThreshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
151 _old_gen_policy_is_ready = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 }
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Interval times use this timer to measure the interval that
a61af66fc99e Initial load
duke
parents:
diff changeset
155 // the mutator runs. Reset after the GC pause has been measured.
a61af66fc99e Initial load
duke
parents:
diff changeset
156 _major_timer.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
157 _major_timer.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 }
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // If the remaining free space in the old generation is less that
a61af66fc99e Initial load
duke
parents:
diff changeset
161 // that expected to be needed by the next collection, do a full
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // collection now.
a61af66fc99e Initial load
duke
parents:
diff changeset
163 bool PSAdaptiveSizePolicy::should_full_GC(size_t old_free_in_bytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 // A similar test is done in the scavenge's should_attempt_scavenge(). If
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // this is changed, decide if that test should also be changed.
a61af66fc99e Initial load
duke
parents:
diff changeset
167 bool result = padded_average_promoted_in_bytes() > (float) old_free_in_bytes;
a61af66fc99e Initial load
duke
parents:
diff changeset
168 if (PrintGCDetails && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
169 if (result) {
a61af66fc99e Initial load
duke
parents:
diff changeset
170 gclog_or_tty->print(" full after scavenge: ");
a61af66fc99e Initial load
duke
parents:
diff changeset
171 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
172 gclog_or_tty->print(" no full after scavenge: ");
a61af66fc99e Initial load
duke
parents:
diff changeset
173 }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 gclog_or_tty->print_cr(" average_promoted " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
175 " padded_average_promoted " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
176 " free in old gen " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
177 (size_t) average_promoted_in_bytes(),
a61af66fc99e Initial load
duke
parents:
diff changeset
178 (size_t) padded_average_promoted_in_bytes(),
a61af66fc99e Initial load
duke
parents:
diff changeset
179 old_free_in_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
180 }
a61af66fc99e Initial load
duke
parents:
diff changeset
181 return result;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void PSAdaptiveSizePolicy::clear_generation_free_space_flags() {
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 AdaptiveSizePolicy::clear_generation_free_space_flags();
a61af66fc99e Initial load
duke
parents:
diff changeset
187
a61af66fc99e Initial load
duke
parents:
diff changeset
188 set_change_old_gen_for_min_pauses(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 set_change_young_gen_for_maj_pauses(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 // If this is not a full GC, only test and modify the young generation.
a61af66fc99e Initial load
duke
parents:
diff changeset
194
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
195 void PSAdaptiveSizePolicy::compute_generations_free_space(
1387
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
196 size_t young_live,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
197 size_t eden_live,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
198 size_t old_live,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
199 size_t cur_eden,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
200 size_t max_old_gen_size,
0bfd3fb24150 6858496: Clear all SoftReferences before an out-of-memory due to GC overhead limit.
jmasa
parents: 0
diff changeset
201 size_t max_eden_size,
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
202 bool is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
203 compute_eden_space_size(young_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
204 eden_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
205 cur_eden,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
206 max_eden_size,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
207 is_full_gc);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
208
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
209 compute_old_gen_free_space(old_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
210 cur_eden,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
211 max_old_gen_size,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
212 is_full_gc);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
213 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
214
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
215 void PSAdaptiveSizePolicy::compute_eden_space_size(
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
216 size_t young_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
217 size_t eden_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
218 size_t cur_eden,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
219 size_t max_eden_size,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
220 bool is_full_gc) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
221
a61af66fc99e Initial load
duke
parents:
diff changeset
222 // Update statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // Time statistics are updated as we go, update footprint stats here
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 1972
diff changeset
224 _avg_base_footprint->sample(BaseFootPrintEstimate);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
225 avg_young_live()->sample(young_live);
a61af66fc99e Initial load
duke
parents:
diff changeset
226 avg_eden_live()->sample(eden_live);
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
227
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
228 // This code used to return if the policy was not ready , i.e.,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
229 // policy_is_ready() returning false. The intent was that
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
230 // decisions below needed major collection times and so could
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
231 // not be made before two major collections. A consequence was
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
232 // adjustments to the young generation were not done until after
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
233 // two major collections even if the minor collections times
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
234 // exceeded the requested goals. Now let the young generation
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
235 // adjust for the minor collection times. Major collection times
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
236 // will be zero for the first collection and will naturally be
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
237 // ignored. Tenured generation adjustments are only made at the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
238 // full collections so until the second major collection has
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
239 // been reached, no tenured generation adjustments will be made.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
240
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
241 // Until we know better, desired promotion size uses the last calculation
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
242 size_t desired_promo_size = _promo_size;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
243
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
244 // Start eden at the current value. The desired value that is stored
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
245 // in _eden_size is not bounded by constraints of the heap and can
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
246 // run away.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
247 //
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
248 // As expected setting desired_eden_size to the current
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
249 // value of desired_eden_size as a starting point
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
250 // caused desired_eden_size to grow way too large and caused
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
251 // an overflow down stream. It may have improved performance in
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
252 // some case but is dangerous.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
253 size_t desired_eden_size = cur_eden;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
254
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
255 // Cache some values. There's a bit of work getting these, so
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
256 // we might save a little time.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
257 const double major_cost = major_gc_cost();
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
258 const double minor_cost = minor_gc_cost();
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
259
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
260 // This method sets the desired eden size. That plus the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
261 // desired survivor space sizes sets the desired young generation
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
262 // size. This methods does not know what the desired survivor
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
263 // size is but expects that other policy will attempt to make
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
264 // the survivor sizes compatible with the live data in the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
265 // young generation. This limit is an estimate of the space left
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
266 // in the young generation after the survivor spaces have been
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
267 // subtracted out.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
268 size_t eden_limit = max_eden_size;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
269
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
270 const double gc_cost_limit = GCTimeLimit/100.0;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
271
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
272 // Which way should we go?
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
273 // if pause requirement is not met
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
274 // adjust size of any generation with average paus exceeding
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
275 // the pause limit. Adjust one pause at a time (the larger)
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
276 // and only make adjustments for the major pause at full collections.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
277 // else if throughput requirement not met
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
278 // adjust the size of the generation with larger gc time. Only
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
279 // adjust one generation at a time.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
280 // else
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
281 // adjust down the total heap size. Adjust down the larger of the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
282 // generations.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
283
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
284 // Add some checks for a threshold for a change. For example,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
285 // a change less than the necessary alignment is probably not worth
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
286 // attempting.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
287
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
289 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
290 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
291 //
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
292 // Check pauses
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
293 //
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
294 // Make changes only to affect one of the pauses (the larger)
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
295 // at a time.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
296 adjust_eden_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
297
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
298 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
299 // Adjust only for the minor pause time goal
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
300 adjust_eden_for_minor_pause_time(is_full_gc, &desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
301
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
302 } else if(adjusted_mutator_cost() < _throughput_goal) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
303 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
304 // This sometimes resulted in skipping to the minimize footprint
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
305 // code. Change this to try and reduce GC time if mutator time is
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
306 // negative for whatever reason. Or for future consideration,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
307 // bail out of the code if mutator time is negative.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
308 //
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
309 // Throughput
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
310 //
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
311 assert(major_cost >= 0.0, "major cost is < 0.0");
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
312 assert(minor_cost >= 0.0, "minor cost is < 0.0");
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
313 // Try to reduce the GC times.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
314 adjust_eden_for_throughput(is_full_gc, &desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
315
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
316 } else {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
317
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
318 // Be conservative about reducing the footprint.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
319 // Do a minimum number of major collections first.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
320 // Have reasonable averages for major and minor collections costs.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
321 if (UseAdaptiveSizePolicyFootprintGoal &&
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
322 young_gen_policy_is_ready() &&
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
323 avg_major_gc_cost()->average() >= 0.0 &&
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
324 avg_minor_gc_cost()->average() >= 0.0) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
325 size_t desired_sum = desired_eden_size + desired_promo_size;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
326 desired_eden_size = adjust_eden_for_footprint(desired_eden_size, desired_sum);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
327 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
328 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
329
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
330 // Note we make the same tests as in the code block below; the code
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
331 // seems a little easier to read with the printing in another block.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
332 if (PrintAdaptiveSizePolicy) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
333 if (desired_eden_size > eden_limit) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
334 gclog_or_tty->print_cr(
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
335 "PSAdaptiveSizePolicy::compute_eden_space_size limits:"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
336 " desired_eden_size: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
337 " old_eden_size: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
338 " eden_limit: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
339 " cur_eden: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
340 " max_eden_size: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
341 " avg_young_live: " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
342 desired_eden_size, _eden_size, eden_limit, cur_eden,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
343 max_eden_size, (size_t)avg_young_live()->average());
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
344 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
345 if (gc_cost() > gc_cost_limit) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
346 gclog_or_tty->print_cr(
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
347 "PSAdaptiveSizePolicy::compute_eden_space_size: gc time limit"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
348 " gc_cost: %f "
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
349 " GCTimeLimit: %d",
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
350 gc_cost(), GCTimeLimit);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
351 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
352 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
353
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
354 // Align everything and make a final limit check
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
355 const size_t alignment = _intra_generation_alignment;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
356 desired_eden_size = align_size_up(desired_eden_size, alignment);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
357 desired_eden_size = MAX2(desired_eden_size, alignment);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
358
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
359 eden_limit = align_size_down(eden_limit, alignment);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
360
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
361 // And one last limit check, now that we've aligned things.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
362 if (desired_eden_size > eden_limit) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
363 // If the policy says to get a larger eden but
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
364 // is hitting the limit, don't decrease eden.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
365 // This can lead to a general drifting down of the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
366 // eden size. Let the tenuring calculation push more
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
367 // into the old gen.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
368 desired_eden_size = MAX2(eden_limit, cur_eden);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
369 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
370
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
371 if (PrintAdaptiveSizePolicy) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
372 // Timing stats
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
373 gclog_or_tty->print(
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
374 "PSAdaptiveSizePolicy::compute_eden_space_size: costs"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
375 " minor_time: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
376 " major_cost: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
377 " mutator_cost: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
378 " throughput_goal: %f",
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
379 minor_gc_cost(), major_gc_cost(), mutator_cost(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
380 _throughput_goal);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
381
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
382 // We give more details if Verbose is set
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
383 if (Verbose) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
384 gclog_or_tty->print( " minor_pause: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
385 " major_pause: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
386 " minor_interval: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
387 " major_interval: %f"
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
388 " pause_goal: %f",
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
389 _avg_minor_pause->padded_average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
390 _avg_major_pause->padded_average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
391 _avg_minor_interval->average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
392 _avg_major_interval->average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
393 gc_pause_goal_sec());
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
394 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
395
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
396 // Footprint stats
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
397 gclog_or_tty->print( " live_space: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
398 " free_space: " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
399 live_space(), free_space());
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
400 // More detail
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
401 if (Verbose) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
402 gclog_or_tty->print( " base_footprint: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
403 " avg_young_live: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
404 " avg_old_live: " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
405 (size_t)_avg_base_footprint->average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
406 (size_t)avg_young_live()->average(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
407 (size_t)avg_old_live()->average());
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
408 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
409
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
410 // And finally, our old and new sizes.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
411 gclog_or_tty->print(" old_eden_size: " SIZE_FORMAT
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
412 " desired_eden_size: " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
413 _eden_size, desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
414 gclog_or_tty->cr();
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
415 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
416
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
417 set_eden_size(desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
418 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
419
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
420 void PSAdaptiveSizePolicy::compute_old_gen_free_space(
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
421 size_t old_live,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
422 size_t cur_eden,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
423 size_t max_old_gen_size,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
424 bool is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
425
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
426 // Update statistics
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
427 // Time statistics are updated as we go, update footprint stats here
0
a61af66fc99e Initial load
duke
parents:
diff changeset
428 if (is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
429 // old_live is only accurate after a full gc
a61af66fc99e Initial load
duke
parents:
diff changeset
430 avg_old_live()->sample(old_live);
a61af66fc99e Initial load
duke
parents:
diff changeset
431 }
a61af66fc99e Initial load
duke
parents:
diff changeset
432
a61af66fc99e Initial load
duke
parents:
diff changeset
433 // This code used to return if the policy was not ready , i.e.,
a61af66fc99e Initial load
duke
parents:
diff changeset
434 // policy_is_ready() returning false. The intent was that
a61af66fc99e Initial load
duke
parents:
diff changeset
435 // decisions below needed major collection times and so could
a61af66fc99e Initial load
duke
parents:
diff changeset
436 // not be made before two major collections. A consequence was
a61af66fc99e Initial load
duke
parents:
diff changeset
437 // adjustments to the young generation were not done until after
a61af66fc99e Initial load
duke
parents:
diff changeset
438 // two major collections even if the minor collections times
a61af66fc99e Initial load
duke
parents:
diff changeset
439 // exceeded the requested goals. Now let the young generation
a61af66fc99e Initial load
duke
parents:
diff changeset
440 // adjust for the minor collection times. Major collection times
a61af66fc99e Initial load
duke
parents:
diff changeset
441 // will be zero for the first collection and will naturally be
a61af66fc99e Initial load
duke
parents:
diff changeset
442 // ignored. Tenured generation adjustments are only made at the
a61af66fc99e Initial load
duke
parents:
diff changeset
443 // full collections so until the second major collection has
a61af66fc99e Initial load
duke
parents:
diff changeset
444 // been reached, no tenured generation adjustments will be made.
a61af66fc99e Initial load
duke
parents:
diff changeset
445
a61af66fc99e Initial load
duke
parents:
diff changeset
446 // Until we know better, desired promotion size uses the last calculation
a61af66fc99e Initial load
duke
parents:
diff changeset
447 size_t desired_promo_size = _promo_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
448
a61af66fc99e Initial load
duke
parents:
diff changeset
449 // Start eden at the current value. The desired value that is stored
a61af66fc99e Initial load
duke
parents:
diff changeset
450 // in _eden_size is not bounded by constraints of the heap and can
a61af66fc99e Initial load
duke
parents:
diff changeset
451 // run away.
a61af66fc99e Initial load
duke
parents:
diff changeset
452 //
a61af66fc99e Initial load
duke
parents:
diff changeset
453 // As expected setting desired_eden_size to the current
a61af66fc99e Initial load
duke
parents:
diff changeset
454 // value of desired_eden_size as a starting point
a61af66fc99e Initial load
duke
parents:
diff changeset
455 // caused desired_eden_size to grow way too large and caused
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // an overflow down stream. It may have improved performance in
a61af66fc99e Initial load
duke
parents:
diff changeset
457 // some case but is dangerous.
a61af66fc99e Initial load
duke
parents:
diff changeset
458 size_t desired_eden_size = cur_eden;
a61af66fc99e Initial load
duke
parents:
diff changeset
459
a61af66fc99e Initial load
duke
parents:
diff changeset
460 // Cache some values. There's a bit of work getting these, so
a61af66fc99e Initial load
duke
parents:
diff changeset
461 // we might save a little time.
a61af66fc99e Initial load
duke
parents:
diff changeset
462 const double major_cost = major_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
463 const double minor_cost = minor_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
464
a61af66fc99e Initial load
duke
parents:
diff changeset
465 // Limits on our growth
a61af66fc99e Initial load
duke
parents:
diff changeset
466 size_t promo_limit = (size_t)(max_old_gen_size - avg_old_live()->average());
a61af66fc99e Initial load
duke
parents:
diff changeset
467
a61af66fc99e Initial load
duke
parents:
diff changeset
468 // But don't force a promo size below the current promo size. Otherwise,
a61af66fc99e Initial load
duke
parents:
diff changeset
469 // the promo size will shrink for no good reason.
a61af66fc99e Initial load
duke
parents:
diff changeset
470 promo_limit = MAX2(promo_limit, _promo_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
471
a61af66fc99e Initial load
duke
parents:
diff changeset
472 const double gc_cost_limit = GCTimeLimit/100.0;
a61af66fc99e Initial load
duke
parents:
diff changeset
473
a61af66fc99e Initial load
duke
parents:
diff changeset
474 // Which way should we go?
a61af66fc99e Initial load
duke
parents:
diff changeset
475 // if pause requirement is not met
a61af66fc99e Initial load
duke
parents:
diff changeset
476 // adjust size of any generation with average paus exceeding
a61af66fc99e Initial load
duke
parents:
diff changeset
477 // the pause limit. Adjust one pause at a time (the larger)
a61af66fc99e Initial load
duke
parents:
diff changeset
478 // and only make adjustments for the major pause at full collections.
a61af66fc99e Initial load
duke
parents:
diff changeset
479 // else if throughput requirement not met
a61af66fc99e Initial load
duke
parents:
diff changeset
480 // adjust the size of the generation with larger gc time. Only
a61af66fc99e Initial load
duke
parents:
diff changeset
481 // adjust one generation at a time.
a61af66fc99e Initial load
duke
parents:
diff changeset
482 // else
a61af66fc99e Initial load
duke
parents:
diff changeset
483 // adjust down the total heap size. Adjust down the larger of the
a61af66fc99e Initial load
duke
parents:
diff changeset
484 // generations.
a61af66fc99e Initial load
duke
parents:
diff changeset
485
a61af66fc99e Initial load
duke
parents:
diff changeset
486 // Add some checks for a threshhold for a change. For example,
a61af66fc99e Initial load
duke
parents:
diff changeset
487 // a change less than the necessary alignment is probably not worth
a61af66fc99e Initial load
duke
parents:
diff changeset
488 // attempting.
a61af66fc99e Initial load
duke
parents:
diff changeset
489
a61af66fc99e Initial load
duke
parents:
diff changeset
490 if ((_avg_minor_pause->padded_average() > gc_pause_goal_sec()) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
491 (_avg_major_pause->padded_average() > gc_pause_goal_sec())) {
a61af66fc99e Initial load
duke
parents:
diff changeset
492 //
a61af66fc99e Initial load
duke
parents:
diff changeset
493 // Check pauses
a61af66fc99e Initial load
duke
parents:
diff changeset
494 //
a61af66fc99e Initial load
duke
parents:
diff changeset
495 // Make changes only to affect one of the pauses (the larger)
a61af66fc99e Initial load
duke
parents:
diff changeset
496 // at a time.
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
497 if (is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
498 set_decide_at_full_gc(decide_at_full_gc_true);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
499 adjust_promo_for_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
500 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
501 } else if (_avg_minor_pause->padded_average() > gc_minor_pause_goal_sec()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 // Adjust only for the minor pause time goal
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
503 adjust_promo_for_minor_pause_time(is_full_gc, &desired_promo_size, &desired_eden_size);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
504 } else if(adjusted_mutator_cost() < _throughput_goal) {
a61af66fc99e Initial load
duke
parents:
diff changeset
505 // This branch used to require that (mutator_cost() > 0.0 in 1.4.2.
a61af66fc99e Initial load
duke
parents:
diff changeset
506 // This sometimes resulted in skipping to the minimize footprint
a61af66fc99e Initial load
duke
parents:
diff changeset
507 // code. Change this to try and reduce GC time if mutator time is
a61af66fc99e Initial load
duke
parents:
diff changeset
508 // negative for whatever reason. Or for future consideration,
a61af66fc99e Initial load
duke
parents:
diff changeset
509 // bail out of the code if mutator time is negative.
a61af66fc99e Initial load
duke
parents:
diff changeset
510 //
a61af66fc99e Initial load
duke
parents:
diff changeset
511 // Throughput
a61af66fc99e Initial load
duke
parents:
diff changeset
512 //
a61af66fc99e Initial load
duke
parents:
diff changeset
513 assert(major_cost >= 0.0, "major cost is < 0.0");
a61af66fc99e Initial load
duke
parents:
diff changeset
514 assert(minor_cost >= 0.0, "minor cost is < 0.0");
a61af66fc99e Initial load
duke
parents:
diff changeset
515 // Try to reduce the GC times.
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
516 if (is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
517 set_decide_at_full_gc(decide_at_full_gc_true);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
518 adjust_promo_for_throughput(is_full_gc, &desired_promo_size);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
519 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
520 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
521
a61af66fc99e Initial load
duke
parents:
diff changeset
522 // Be conservative about reducing the footprint.
a61af66fc99e Initial load
duke
parents:
diff changeset
523 // Do a minimum number of major collections first.
a61af66fc99e Initial load
duke
parents:
diff changeset
524 // Have reasonable averages for major and minor collections costs.
a61af66fc99e Initial load
duke
parents:
diff changeset
525 if (UseAdaptiveSizePolicyFootprintGoal &&
a61af66fc99e Initial load
duke
parents:
diff changeset
526 young_gen_policy_is_ready() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
527 avg_major_gc_cost()->average() >= 0.0 &&
a61af66fc99e Initial load
duke
parents:
diff changeset
528 avg_minor_gc_cost()->average() >= 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
529 if (is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
530 set_decide_at_full_gc(decide_at_full_gc_true);
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
531 size_t desired_sum = desired_eden_size + desired_promo_size;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
532 desired_promo_size = adjust_promo_for_footprint(desired_promo_size, desired_sum);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
533 }
a61af66fc99e Initial load
duke
parents:
diff changeset
534 }
a61af66fc99e Initial load
duke
parents:
diff changeset
535 }
a61af66fc99e Initial load
duke
parents:
diff changeset
536
a61af66fc99e Initial load
duke
parents:
diff changeset
537 // Note we make the same tests as in the code block below; the code
a61af66fc99e Initial load
duke
parents:
diff changeset
538 // seems a little easier to read with the printing in another block.
a61af66fc99e Initial load
duke
parents:
diff changeset
539 if (PrintAdaptiveSizePolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
540 if (desired_promo_size > promo_limit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
541 // "free_in_old_gen" was the original value for used for promo_limit
a61af66fc99e Initial load
duke
parents:
diff changeset
542 size_t free_in_old_gen = (size_t)(max_old_gen_size - avg_old_live()->average());
a61af66fc99e Initial load
duke
parents:
diff changeset
543 gclog_or_tty->print_cr(
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
544 "PSAdaptiveSizePolicy::compute_old_gen_free_space limits:"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
545 " desired_promo_size: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
546 " promo_limit: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
547 " free_in_old_gen: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
548 " max_old_gen_size: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
549 " avg_old_live: " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
550 desired_promo_size, promo_limit, free_in_old_gen,
a61af66fc99e Initial load
duke
parents:
diff changeset
551 max_old_gen_size, (size_t) avg_old_live()->average());
a61af66fc99e Initial load
duke
parents:
diff changeset
552 }
a61af66fc99e Initial load
duke
parents:
diff changeset
553 if (gc_cost() > gc_cost_limit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
554 gclog_or_tty->print_cr(
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
555 "PSAdaptiveSizePolicy::compute_old_gen_free_space: gc time limit"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
556 " gc_cost: %f "
a61af66fc99e Initial load
duke
parents:
diff changeset
557 " GCTimeLimit: %d",
a61af66fc99e Initial load
duke
parents:
diff changeset
558 gc_cost(), GCTimeLimit);
a61af66fc99e Initial load
duke
parents:
diff changeset
559 }
a61af66fc99e Initial load
duke
parents:
diff changeset
560 }
a61af66fc99e Initial load
duke
parents:
diff changeset
561
a61af66fc99e Initial load
duke
parents:
diff changeset
562 // Align everything and make a final limit check
a61af66fc99e Initial load
duke
parents:
diff changeset
563 const size_t alignment = _intra_generation_alignment;
a61af66fc99e Initial load
duke
parents:
diff changeset
564 desired_promo_size = align_size_up(desired_promo_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
565 desired_promo_size = MAX2(desired_promo_size, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
566
a61af66fc99e Initial load
duke
parents:
diff changeset
567 promo_limit = align_size_down(promo_limit, alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
568
a61af66fc99e Initial load
duke
parents:
diff changeset
569 // And one last limit check, now that we've aligned things.
a61af66fc99e Initial load
duke
parents:
diff changeset
570 desired_promo_size = MIN2(desired_promo_size, promo_limit);
a61af66fc99e Initial load
duke
parents:
diff changeset
571
a61af66fc99e Initial load
duke
parents:
diff changeset
572 if (PrintAdaptiveSizePolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
573 // Timing stats
a61af66fc99e Initial load
duke
parents:
diff changeset
574 gclog_or_tty->print(
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
575 "PSAdaptiveSizePolicy::compute_old_gen_free_space: costs"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
576 " minor_time: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
577 " major_cost: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
578 " mutator_cost: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
579 " throughput_goal: %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
580 minor_gc_cost(), major_gc_cost(), mutator_cost(),
a61af66fc99e Initial load
duke
parents:
diff changeset
581 _throughput_goal);
a61af66fc99e Initial load
duke
parents:
diff changeset
582
a61af66fc99e Initial load
duke
parents:
diff changeset
583 // We give more details if Verbose is set
a61af66fc99e Initial load
duke
parents:
diff changeset
584 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
585 gclog_or_tty->print( " minor_pause: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
586 " major_pause: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
587 " minor_interval: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
588 " major_interval: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
589 " pause_goal: %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
590 _avg_minor_pause->padded_average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
591 _avg_major_pause->padded_average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
592 _avg_minor_interval->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
593 _avg_major_interval->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
594 gc_pause_goal_sec());
a61af66fc99e Initial load
duke
parents:
diff changeset
595 }
a61af66fc99e Initial load
duke
parents:
diff changeset
596
a61af66fc99e Initial load
duke
parents:
diff changeset
597 // Footprint stats
a61af66fc99e Initial load
duke
parents:
diff changeset
598 gclog_or_tty->print( " live_space: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
599 " free_space: " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
600 live_space(), free_space());
a61af66fc99e Initial load
duke
parents:
diff changeset
601 // More detail
a61af66fc99e Initial load
duke
parents:
diff changeset
602 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
603 gclog_or_tty->print( " base_footprint: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
604 " avg_young_live: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
605 " avg_old_live: " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
606 (size_t)_avg_base_footprint->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
607 (size_t)avg_young_live()->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
608 (size_t)avg_old_live()->average());
a61af66fc99e Initial load
duke
parents:
diff changeset
609 }
a61af66fc99e Initial load
duke
parents:
diff changeset
610
a61af66fc99e Initial load
duke
parents:
diff changeset
611 // And finally, our old and new sizes.
a61af66fc99e Initial load
duke
parents:
diff changeset
612 gclog_or_tty->print(" old_promo_size: " SIZE_FORMAT
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
613 " desired_promo_size: " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
614 _promo_size, desired_promo_size);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
615 gclog_or_tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
616 }
a61af66fc99e Initial load
duke
parents:
diff changeset
617
a61af66fc99e Initial load
duke
parents:
diff changeset
618 set_promo_size(desired_promo_size);
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
619 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
620
a61af66fc99e Initial load
duke
parents:
diff changeset
621 void PSAdaptiveSizePolicy::decay_supplemental_growth(bool is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
622 // Decay the supplemental increment? Decay the supplement growth
a61af66fc99e Initial load
duke
parents:
diff changeset
623 // factor even if it is not used. It is only meant to give a boost
a61af66fc99e Initial load
duke
parents:
diff changeset
624 // to the initial growth and if it is not used, then it was not
a61af66fc99e Initial load
duke
parents:
diff changeset
625 // needed.
a61af66fc99e Initial load
duke
parents:
diff changeset
626 if (is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
627 // Don't wait for the threshold value for the major collections. If
a61af66fc99e Initial load
duke
parents:
diff changeset
628 // here, the supplemental growth term was used and should decay.
a61af66fc99e Initial load
duke
parents:
diff changeset
629 if ((_avg_major_pause->count() % TenuredGenerationSizeSupplementDecay)
a61af66fc99e Initial load
duke
parents:
diff changeset
630 == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
631 _old_gen_size_increment_supplement =
a61af66fc99e Initial load
duke
parents:
diff changeset
632 _old_gen_size_increment_supplement >> 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
633 }
a61af66fc99e Initial load
duke
parents:
diff changeset
634 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
635 if ((_avg_minor_pause->count() >= AdaptiveSizePolicyReadyThreshold) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
636 (_avg_minor_pause->count() % YoungGenerationSizeSupplementDecay) == 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
637 _young_gen_size_increment_supplement =
a61af66fc99e Initial load
duke
parents:
diff changeset
638 _young_gen_size_increment_supplement >> 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
639 }
a61af66fc99e Initial load
duke
parents:
diff changeset
640 }
a61af66fc99e Initial load
duke
parents:
diff changeset
641 }
a61af66fc99e Initial load
duke
parents:
diff changeset
642
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
643 void PSAdaptiveSizePolicy::adjust_promo_for_minor_pause_time(bool is_full_gc,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
644 size_t* desired_promo_size_ptr, size_t* desired_eden_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
645
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
646 if (PSAdjustTenuredGenForMinorPause) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
647 if (is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
648 set_decide_at_full_gc(decide_at_full_gc_true);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
649 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
650 // If the desired eden size is as small as it will get,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
651 // try to adjust the old gen size.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
652 if (*desired_eden_size_ptr <= _intra_generation_alignment) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
653 // Vary the old gen size to reduce the young gen pause. This
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
654 // may not be a good idea. This is just a test.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
655 if (minor_pause_old_estimator()->decrement_will_decrease()) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
656 set_change_old_gen_for_min_pauses(decrease_old_gen_for_min_pauses_true);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
657 *desired_promo_size_ptr =
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
658 _promo_size - promo_decrement_aligned_down(*desired_promo_size_ptr);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
659 } else {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
660 set_change_old_gen_for_min_pauses(increase_old_gen_for_min_pauses_true);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
661 size_t promo_heap_delta =
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
662 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
663 if ((*desired_promo_size_ptr + promo_heap_delta) >
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
664 *desired_promo_size_ptr) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
665 *desired_promo_size_ptr =
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
666 _promo_size + promo_heap_delta;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
667 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
668 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
669 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
670 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
671 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
672
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
673 void PSAdaptiveSizePolicy::adjust_eden_for_minor_pause_time(bool is_full_gc,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
674 size_t* desired_eden_size_ptr) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
675
0
a61af66fc99e Initial load
duke
parents:
diff changeset
676 // Adjust the young generation size to reduce pause time of
a61af66fc99e Initial load
duke
parents:
diff changeset
677 // of collections.
a61af66fc99e Initial load
duke
parents:
diff changeset
678 //
a61af66fc99e Initial load
duke
parents:
diff changeset
679 // The AdaptiveSizePolicyInitializingSteps test is not used
a61af66fc99e Initial load
duke
parents:
diff changeset
680 // here. It has not seemed to be needed but perhaps should
a61af66fc99e Initial load
duke
parents:
diff changeset
681 // be added for consistency.
a61af66fc99e Initial load
duke
parents:
diff changeset
682 if (minor_pause_young_estimator()->decrement_will_decrease()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
683 // reduce eden size
a61af66fc99e Initial load
duke
parents:
diff changeset
684 set_change_young_gen_for_min_pauses(
a61af66fc99e Initial load
duke
parents:
diff changeset
685 decrease_young_gen_for_min_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
686 *desired_eden_size_ptr = *desired_eden_size_ptr -
a61af66fc99e Initial load
duke
parents:
diff changeset
687 eden_decrement_aligned_down(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
688 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
689 // EXPERIMENTAL ADJUSTMENT
a61af66fc99e Initial load
duke
parents:
diff changeset
690 // Only record that the estimator indicated such an action.
a61af66fc99e Initial load
duke
parents:
diff changeset
691 // *desired_eden_size_ptr = *desired_eden_size_ptr + eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
692 set_change_young_gen_for_min_pauses(
a61af66fc99e Initial load
duke
parents:
diff changeset
693 increase_young_gen_for_min_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
694 }
a61af66fc99e Initial load
duke
parents:
diff changeset
695 }
a61af66fc99e Initial load
duke
parents:
diff changeset
696
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
697 void PSAdaptiveSizePolicy::adjust_promo_for_pause_time(bool is_full_gc,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
698 size_t* desired_promo_size_ptr,
a61af66fc99e Initial load
duke
parents:
diff changeset
699 size_t* desired_eden_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
700
a61af66fc99e Initial load
duke
parents:
diff changeset
701 size_t promo_heap_delta = 0;
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
702 // Add some checks for a threshold for a change. For example,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
703 // a change less than the required alignment is probably not worth
a61af66fc99e Initial load
duke
parents:
diff changeset
704 // attempting.
a61af66fc99e Initial load
duke
parents:
diff changeset
705
a61af66fc99e Initial load
duke
parents:
diff changeset
706 if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
707 adjust_promo_for_minor_pause_time(is_full_gc, desired_promo_size_ptr, desired_eden_size_ptr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
708 // major pause adjustments
a61af66fc99e Initial load
duke
parents:
diff changeset
709 } else if (is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
710 // Adjust for the major pause time only at full gc's because the
a61af66fc99e Initial load
duke
parents:
diff changeset
711 // affects of a change can only be seen at full gc's.
a61af66fc99e Initial load
duke
parents:
diff changeset
712
a61af66fc99e Initial load
duke
parents:
diff changeset
713 // Reduce old generation size to reduce pause?
a61af66fc99e Initial load
duke
parents:
diff changeset
714 if (major_pause_old_estimator()->decrement_will_decrease()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
715 // reduce old generation size
a61af66fc99e Initial load
duke
parents:
diff changeset
716 set_change_old_gen_for_maj_pauses(decrease_old_gen_for_maj_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
717 promo_heap_delta = promo_decrement_aligned_down(*desired_promo_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
718 *desired_promo_size_ptr = _promo_size - promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
719 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
720 // EXPERIMENTAL ADJUSTMENT
a61af66fc99e Initial load
duke
parents:
diff changeset
721 // Only record that the estimator indicated such an action.
a61af66fc99e Initial load
duke
parents:
diff changeset
722 // *desired_promo_size_ptr = _promo_size +
a61af66fc99e Initial load
duke
parents:
diff changeset
723 // promo_increment_aligned_up(*desired_promo_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
724 set_change_old_gen_for_maj_pauses(increase_old_gen_for_maj_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
725 }
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
726 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
727
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
728 if (PrintAdaptiveSizePolicy && Verbose) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
729 gclog_or_tty->print_cr(
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
730 "PSAdaptiveSizePolicy::adjust_promo_for_pause_time "
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
731 "adjusting gen sizes for major pause (avg %f goal %f). "
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
732 "desired_promo_size " SIZE_FORMAT " promo delta " SIZE_FORMAT,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
733 _avg_major_pause->average(), gc_pause_goal_sec(),
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
734 *desired_promo_size_ptr, promo_heap_delta);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
735 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
736 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
737
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
738 void PSAdaptiveSizePolicy::adjust_eden_for_pause_time(bool is_full_gc,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
739 size_t* desired_promo_size_ptr,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
740 size_t* desired_eden_size_ptr) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
741
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
742 size_t eden_heap_delta = 0;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
743 // Add some checks for a threshold for a change. For example,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
744 // a change less than the required alignment is probably not worth
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
745 // attempting.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
746 if (_avg_minor_pause->padded_average() > _avg_major_pause->padded_average()) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
747 adjust_eden_for_minor_pause_time(is_full_gc,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
748 desired_eden_size_ptr);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
749 // major pause adjustments
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
750 } else if (is_full_gc) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
751 // Adjust for the major pause time only at full gc's because the
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
752 // affects of a change can only be seen at full gc's.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
753 if (PSAdjustYoungGenForMajorPause) {
a61af66fc99e Initial load
duke
parents:
diff changeset
754 // If the promo size is at the minimum (i.e., the old gen
a61af66fc99e Initial load
duke
parents:
diff changeset
755 // size will not actually decrease), consider changing the
a61af66fc99e Initial load
duke
parents:
diff changeset
756 // young gen size.
a61af66fc99e Initial load
duke
parents:
diff changeset
757 if (*desired_promo_size_ptr < _intra_generation_alignment) {
a61af66fc99e Initial load
duke
parents:
diff changeset
758 // If increasing the young generation will decrease the old gen
a61af66fc99e Initial load
duke
parents:
diff changeset
759 // pause, do it.
a61af66fc99e Initial load
duke
parents:
diff changeset
760 // During startup there is noise in the statistics for deciding
a61af66fc99e Initial load
duke
parents:
diff changeset
761 // on whether to increase or decrease the young gen size. For
a61af66fc99e Initial load
duke
parents:
diff changeset
762 // some number of iterations, just try to increase the young
a61af66fc99e Initial load
duke
parents:
diff changeset
763 // gen size if the major pause is too long to try and establish
a61af66fc99e Initial load
duke
parents:
diff changeset
764 // good statistics for later decisions.
a61af66fc99e Initial load
duke
parents:
diff changeset
765 if (major_pause_young_estimator()->increment_will_decrease() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
766 (_young_gen_change_for_major_pause_count
a61af66fc99e Initial load
duke
parents:
diff changeset
767 <= AdaptiveSizePolicyInitializingSteps)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
768 set_change_young_gen_for_maj_pauses(
a61af66fc99e Initial load
duke
parents:
diff changeset
769 increase_young_gen_for_maj_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
770 eden_heap_delta = eden_increment_aligned_up(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
771 *desired_eden_size_ptr = _eden_size + eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
772 _young_gen_change_for_major_pause_count++;
a61af66fc99e Initial load
duke
parents:
diff changeset
773 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
774 // Record that decreasing the young gen size would decrease
a61af66fc99e Initial load
duke
parents:
diff changeset
775 // the major pause
a61af66fc99e Initial load
duke
parents:
diff changeset
776 set_change_young_gen_for_maj_pauses(
a61af66fc99e Initial load
duke
parents:
diff changeset
777 decrease_young_gen_for_maj_pauses_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
778 eden_heap_delta = eden_decrement_aligned_down(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
779 *desired_eden_size_ptr = _eden_size - eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
780 }
a61af66fc99e Initial load
duke
parents:
diff changeset
781 }
a61af66fc99e Initial load
duke
parents:
diff changeset
782 }
a61af66fc99e Initial load
duke
parents:
diff changeset
783 }
a61af66fc99e Initial load
duke
parents:
diff changeset
784
a61af66fc99e Initial load
duke
parents:
diff changeset
785 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
786 gclog_or_tty->print_cr(
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
787 "PSAdaptiveSizePolicy::adjust_eden_for_pause_time "
0
a61af66fc99e Initial load
duke
parents:
diff changeset
788 "adjusting gen sizes for major pause (avg %f goal %f). "
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
789 "desired_eden_size " SIZE_FORMAT " eden delta " SIZE_FORMAT,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
790 _avg_major_pause->average(), gc_pause_goal_sec(),
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
791 *desired_eden_size_ptr, eden_heap_delta);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
792 }
a61af66fc99e Initial load
duke
parents:
diff changeset
793 }
a61af66fc99e Initial load
duke
parents:
diff changeset
794
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
795 void PSAdaptiveSizePolicy::adjust_promo_for_throughput(bool is_full_gc,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
796 size_t* desired_promo_size_ptr) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
797
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
798 // Add some checks for a threshold for a change. For example,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
799 // a change less than the required alignment is probably not worth
a61af66fc99e Initial load
duke
parents:
diff changeset
800 // attempting.
a61af66fc99e Initial load
duke
parents:
diff changeset
801
a61af66fc99e Initial load
duke
parents:
diff changeset
802 if ((gc_cost() + mutator_cost()) == 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
803 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
804 }
a61af66fc99e Initial load
duke
parents:
diff changeset
805
a61af66fc99e Initial load
duke
parents:
diff changeset
806 if (PrintAdaptiveSizePolicy && Verbose) {
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
807 gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_promo_for_throughput("
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
808 "is_full: %d, promo: " SIZE_FORMAT "): ",
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
809 is_full_gc, *desired_promo_size_ptr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
810 gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f "
a61af66fc99e Initial load
duke
parents:
diff changeset
811 "minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost());
a61af66fc99e Initial load
duke
parents:
diff changeset
812 }
a61af66fc99e Initial load
duke
parents:
diff changeset
813
a61af66fc99e Initial load
duke
parents:
diff changeset
814 // Tenured generation
a61af66fc99e Initial load
duke
parents:
diff changeset
815 if (is_full_gc) {
a61af66fc99e Initial load
duke
parents:
diff changeset
816 // Calculate the change to use for the tenured gen.
a61af66fc99e Initial load
duke
parents:
diff changeset
817 size_t scaled_promo_heap_delta = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
818 // Can the increment to the generation be scaled?
a61af66fc99e Initial load
duke
parents:
diff changeset
819 if (gc_cost() >= 0.0 && major_gc_cost() >= 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
820 size_t promo_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
821 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
822 double scale_by_ratio = major_gc_cost() / gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
823 scaled_promo_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
824 (size_t) (scale_by_ratio * (double) promo_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
825 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
826 gclog_or_tty->print_cr(
a61af66fc99e Initial load
duke
parents:
diff changeset
827 "Scaled tenured increment: " SIZE_FORMAT " by %f down to "
a61af66fc99e Initial load
duke
parents:
diff changeset
828 SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
829 promo_heap_delta, scale_by_ratio, scaled_promo_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
830 }
a61af66fc99e Initial load
duke
parents:
diff changeset
831 } else if (major_gc_cost() >= 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
832 // Scaling is not going to work. If the major gc time is the
a61af66fc99e Initial load
duke
parents:
diff changeset
833 // larger, give it a full increment.
a61af66fc99e Initial load
duke
parents:
diff changeset
834 if (major_gc_cost() >= minor_gc_cost()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
835 scaled_promo_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
836 promo_increment_with_supplement_aligned_up(*desired_promo_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
837 }
a61af66fc99e Initial load
duke
parents:
diff changeset
838 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
839 // Don't expect to get here but it's ok if it does
a61af66fc99e Initial load
duke
parents:
diff changeset
840 // in the product build since the delta will be 0
a61af66fc99e Initial load
duke
parents:
diff changeset
841 // and nothing will change.
a61af66fc99e Initial load
duke
parents:
diff changeset
842 assert(false, "Unexpected value for gc costs");
a61af66fc99e Initial load
duke
parents:
diff changeset
843 }
a61af66fc99e Initial load
duke
parents:
diff changeset
844
a61af66fc99e Initial load
duke
parents:
diff changeset
845 switch (AdaptiveSizeThroughPutPolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
846 case 1:
a61af66fc99e Initial load
duke
parents:
diff changeset
847 // Early in the run the statistics might not be good. Until
a61af66fc99e Initial load
duke
parents:
diff changeset
848 // a specific number of collections have been, use the heuristic
a61af66fc99e Initial load
duke
parents:
diff changeset
849 // that a larger generation size means lower collection costs.
a61af66fc99e Initial load
duke
parents:
diff changeset
850 if (major_collection_estimator()->increment_will_decrease() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
851 (_old_gen_change_for_major_throughput
a61af66fc99e Initial load
duke
parents:
diff changeset
852 <= AdaptiveSizePolicyInitializingSteps)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
853 // Increase tenured generation size to reduce major collection cost
a61af66fc99e Initial load
duke
parents:
diff changeset
854 if ((*desired_promo_size_ptr + scaled_promo_heap_delta) >
a61af66fc99e Initial load
duke
parents:
diff changeset
855 *desired_promo_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
856 *desired_promo_size_ptr = _promo_size + scaled_promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
857 }
a61af66fc99e Initial load
duke
parents:
diff changeset
858 set_change_old_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
859 increase_old_gen_for_throughput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
860 _old_gen_change_for_major_throughput++;
a61af66fc99e Initial load
duke
parents:
diff changeset
861 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
862 // EXPERIMENTAL ADJUSTMENT
a61af66fc99e Initial load
duke
parents:
diff changeset
863 // Record that decreasing the old gen size would decrease
a61af66fc99e Initial load
duke
parents:
diff changeset
864 // the major collection cost but don't do it.
a61af66fc99e Initial load
duke
parents:
diff changeset
865 // *desired_promo_size_ptr = _promo_size -
a61af66fc99e Initial load
duke
parents:
diff changeset
866 // promo_decrement_aligned_down(*desired_promo_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
867 set_change_old_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
868 decrease_old_gen_for_throughput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
869 }
a61af66fc99e Initial load
duke
parents:
diff changeset
870
a61af66fc99e Initial load
duke
parents:
diff changeset
871 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
872 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
873 // Simplest strategy
a61af66fc99e Initial load
duke
parents:
diff changeset
874 if ((*desired_promo_size_ptr + scaled_promo_heap_delta) >
a61af66fc99e Initial load
duke
parents:
diff changeset
875 *desired_promo_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
876 *desired_promo_size_ptr = *desired_promo_size_ptr +
a61af66fc99e Initial load
duke
parents:
diff changeset
877 scaled_promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
878 }
a61af66fc99e Initial load
duke
parents:
diff changeset
879 set_change_old_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
880 increase_old_gen_for_throughput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
881 _old_gen_change_for_major_throughput++;
a61af66fc99e Initial load
duke
parents:
diff changeset
882 }
a61af66fc99e Initial load
duke
parents:
diff changeset
883
a61af66fc99e Initial load
duke
parents:
diff changeset
884 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
885 gclog_or_tty->print_cr(
a61af66fc99e Initial load
duke
parents:
diff changeset
886 "adjusting tenured gen for throughput (avg %f goal %f). "
a61af66fc99e Initial load
duke
parents:
diff changeset
887 "desired_promo_size " SIZE_FORMAT " promo_delta " SIZE_FORMAT ,
a61af66fc99e Initial load
duke
parents:
diff changeset
888 mutator_cost(), _throughput_goal,
a61af66fc99e Initial load
duke
parents:
diff changeset
889 *desired_promo_size_ptr, scaled_promo_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
890 }
a61af66fc99e Initial load
duke
parents:
diff changeset
891 }
10288
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
892 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
893
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
894 void PSAdaptiveSizePolicy::adjust_eden_for_throughput(bool is_full_gc,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
895 size_t* desired_eden_size_ptr) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
896
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
897 // Add some checks for a threshold for a change. For example,
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
898 // a change less than the required alignment is probably not worth
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
899 // attempting.
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
900
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
901 if ((gc_cost() + mutator_cost()) == 0.0) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
902 return;
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
903 }
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
904
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
905 if (PrintAdaptiveSizePolicy && Verbose) {
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
906 gclog_or_tty->print("\nPSAdaptiveSizePolicy::adjust_eden_for_throughput("
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
907 "is_full: %d, cur_eden: " SIZE_FORMAT "): ",
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
908 is_full_gc, *desired_eden_size_ptr);
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
909 gclog_or_tty->print_cr("mutator_cost %f major_gc_cost %f "
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
910 "minor_gc_cost %f", mutator_cost(), major_gc_cost(), minor_gc_cost());
eba99d16dc6f 8007763: Refactoring: split up compute_generation_free_space() into two functions for class PSAdaptiveSizePolicy
tamao
parents: 6818
diff changeset
911 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
912
a61af66fc99e Initial load
duke
parents:
diff changeset
913 // Young generation
a61af66fc99e Initial load
duke
parents:
diff changeset
914 size_t scaled_eden_heap_delta = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
915 // Can the increment to the generation be scaled?
a61af66fc99e Initial load
duke
parents:
diff changeset
916 if (gc_cost() >= 0.0 && minor_gc_cost() >= 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
917 size_t eden_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
918 eden_increment_with_supplement_aligned_up(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
919 double scale_by_ratio = minor_gc_cost() / gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
920 assert(scale_by_ratio <= 1.0 && scale_by_ratio >= 0.0, "Scaling is wrong");
a61af66fc99e Initial load
duke
parents:
diff changeset
921 scaled_eden_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
922 (size_t) (scale_by_ratio * (double) eden_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
923 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
924 gclog_or_tty->print_cr(
a61af66fc99e Initial load
duke
parents:
diff changeset
925 "Scaled eden increment: " SIZE_FORMAT " by %f down to "
a61af66fc99e Initial load
duke
parents:
diff changeset
926 SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
927 eden_heap_delta, scale_by_ratio, scaled_eden_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
928 }
a61af66fc99e Initial load
duke
parents:
diff changeset
929 } else if (minor_gc_cost() >= 0.0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
930 // Scaling is not going to work. If the minor gc time is the
a61af66fc99e Initial load
duke
parents:
diff changeset
931 // larger, give it a full increment.
a61af66fc99e Initial load
duke
parents:
diff changeset
932 if (minor_gc_cost() > major_gc_cost()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
933 scaled_eden_heap_delta =
a61af66fc99e Initial load
duke
parents:
diff changeset
934 eden_increment_with_supplement_aligned_up(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
935 }
a61af66fc99e Initial load
duke
parents:
diff changeset
936 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
937 // Don't expect to get here but it's ok if it does
a61af66fc99e Initial load
duke
parents:
diff changeset
938 // in the product build since the delta will be 0
a61af66fc99e Initial load
duke
parents:
diff changeset
939 // and nothing will change.
a61af66fc99e Initial load
duke
parents:
diff changeset
940 assert(false, "Unexpected value for gc costs");
a61af66fc99e Initial load
duke
parents:
diff changeset
941 }
a61af66fc99e Initial load
duke
parents:
diff changeset
942
a61af66fc99e Initial load
duke
parents:
diff changeset
943 // Use a heuristic for some number of collections to give
a61af66fc99e Initial load
duke
parents:
diff changeset
944 // the averages time to settle down.
a61af66fc99e Initial load
duke
parents:
diff changeset
945 switch (AdaptiveSizeThroughPutPolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
946 case 1:
a61af66fc99e Initial load
duke
parents:
diff changeset
947 if (minor_collection_estimator()->increment_will_decrease() ||
a61af66fc99e Initial load
duke
parents:
diff changeset
948 (_young_gen_change_for_minor_throughput
a61af66fc99e Initial load
duke
parents:
diff changeset
949 <= AdaptiveSizePolicyInitializingSteps)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
950 // Expand young generation size to reduce frequency of
a61af66fc99e Initial load
duke
parents:
diff changeset
951 // of collections.
a61af66fc99e Initial load
duke
parents:
diff changeset
952 if ((*desired_eden_size_ptr + scaled_eden_heap_delta) >
a61af66fc99e Initial load
duke
parents:
diff changeset
953 *desired_eden_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
954 *desired_eden_size_ptr =
a61af66fc99e Initial load
duke
parents:
diff changeset
955 *desired_eden_size_ptr + scaled_eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
956 }
a61af66fc99e Initial load
duke
parents:
diff changeset
957 set_change_young_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
958 increase_young_gen_for_througput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
959 _young_gen_change_for_minor_throughput++;
a61af66fc99e Initial load
duke
parents:
diff changeset
960 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
961 // EXPERIMENTAL ADJUSTMENT
a61af66fc99e Initial load
duke
parents:
diff changeset
962 // Record that decreasing the young gen size would decrease
a61af66fc99e Initial load
duke
parents:
diff changeset
963 // the minor collection cost but don't do it.
a61af66fc99e Initial load
duke
parents:
diff changeset
964 // *desired_eden_size_ptr = _eden_size -
a61af66fc99e Initial load
duke
parents:
diff changeset
965 // eden_decrement_aligned_down(*desired_eden_size_ptr);
a61af66fc99e Initial load
duke
parents:
diff changeset
966 set_change_young_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
967 decrease_young_gen_for_througput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
968 }
a61af66fc99e Initial load
duke
parents:
diff changeset
969 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
970 default:
a61af66fc99e Initial load
duke
parents:
diff changeset
971 if ((*desired_eden_size_ptr + scaled_eden_heap_delta) >
a61af66fc99e Initial load
duke
parents:
diff changeset
972 *desired_eden_size_ptr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
973 *desired_eden_size_ptr =
a61af66fc99e Initial load
duke
parents:
diff changeset
974 *desired_eden_size_ptr + scaled_eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
975 }
a61af66fc99e Initial load
duke
parents:
diff changeset
976 set_change_young_gen_for_throughput(
a61af66fc99e Initial load
duke
parents:
diff changeset
977 increase_young_gen_for_througput_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
978 _young_gen_change_for_minor_throughput++;
a61af66fc99e Initial load
duke
parents:
diff changeset
979 }
a61af66fc99e Initial load
duke
parents:
diff changeset
980
a61af66fc99e Initial load
duke
parents:
diff changeset
981 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
982 gclog_or_tty->print_cr(
a61af66fc99e Initial load
duke
parents:
diff changeset
983 "adjusting eden for throughput (avg %f goal %f). desired_eden_size "
a61af66fc99e Initial load
duke
parents:
diff changeset
984 SIZE_FORMAT " eden delta " SIZE_FORMAT "\n",
a61af66fc99e Initial load
duke
parents:
diff changeset
985 mutator_cost(), _throughput_goal,
a61af66fc99e Initial load
duke
parents:
diff changeset
986 *desired_eden_size_ptr, scaled_eden_heap_delta);
a61af66fc99e Initial load
duke
parents:
diff changeset
987 }
a61af66fc99e Initial load
duke
parents:
diff changeset
988 }
a61af66fc99e Initial load
duke
parents:
diff changeset
989
a61af66fc99e Initial load
duke
parents:
diff changeset
990 size_t PSAdaptiveSizePolicy::adjust_promo_for_footprint(
a61af66fc99e Initial load
duke
parents:
diff changeset
991 size_t desired_promo_size, size_t desired_sum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
992 assert(desired_promo_size <= desired_sum, "Inconsistent parameters");
a61af66fc99e Initial load
duke
parents:
diff changeset
993 set_decrease_for_footprint(decrease_old_gen_for_footprint_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
994
a61af66fc99e Initial load
duke
parents:
diff changeset
995 size_t change = promo_decrement(desired_promo_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
996 change = scale_down(change, desired_promo_size, desired_sum);
a61af66fc99e Initial load
duke
parents:
diff changeset
997
a61af66fc99e Initial load
duke
parents:
diff changeset
998 size_t reduced_size = desired_promo_size - change;
a61af66fc99e Initial load
duke
parents:
diff changeset
999
a61af66fc99e Initial load
duke
parents:
diff changeset
1000 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1001 gclog_or_tty->print_cr(
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
1002 "AdaptiveSizePolicy::adjust_promo_for_footprint "
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1003 "adjusting tenured gen for footprint. "
a61af66fc99e Initial load
duke
parents:
diff changeset
1004 "starting promo size " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
1005 " reduced promo size " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
1006 " promo delta " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
1007 desired_promo_size, reduced_size, change );
a61af66fc99e Initial load
duke
parents:
diff changeset
1008 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1009
a61af66fc99e Initial load
duke
parents:
diff changeset
1010 assert(reduced_size <= desired_promo_size, "Inconsistent result");
a61af66fc99e Initial load
duke
parents:
diff changeset
1011 return reduced_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
1012 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1013
a61af66fc99e Initial load
duke
parents:
diff changeset
1014 size_t PSAdaptiveSizePolicy::adjust_eden_for_footprint(
a61af66fc99e Initial load
duke
parents:
diff changeset
1015 size_t desired_eden_size, size_t desired_sum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1016 assert(desired_eden_size <= desired_sum, "Inconsistent parameters");
a61af66fc99e Initial load
duke
parents:
diff changeset
1017 set_decrease_for_footprint(decrease_young_gen_for_footprint_true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1018
a61af66fc99e Initial load
duke
parents:
diff changeset
1019 size_t change = eden_decrement(desired_eden_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
1020 change = scale_down(change, desired_eden_size, desired_sum);
a61af66fc99e Initial load
duke
parents:
diff changeset
1021
a61af66fc99e Initial load
duke
parents:
diff changeset
1022 size_t reduced_size = desired_eden_size - change;
a61af66fc99e Initial load
duke
parents:
diff changeset
1023
a61af66fc99e Initial load
duke
parents:
diff changeset
1024 if (PrintAdaptiveSizePolicy && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1025 gclog_or_tty->print_cr(
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
1026 "AdaptiveSizePolicy::adjust_eden_for_footprint "
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1027 "adjusting eden for footprint. "
a61af66fc99e Initial load
duke
parents:
diff changeset
1028 " starting eden size " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
1029 " reduced eden size " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
1030 " eden delta " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
1031 desired_eden_size, reduced_size, change);
a61af66fc99e Initial load
duke
parents:
diff changeset
1032 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1033
a61af66fc99e Initial load
duke
parents:
diff changeset
1034 assert(reduced_size <= desired_eden_size, "Inconsistent result");
a61af66fc99e Initial load
duke
parents:
diff changeset
1035 return reduced_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
1036 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1037
a61af66fc99e Initial load
duke
parents:
diff changeset
1038 // Scale down "change" by the factor
a61af66fc99e Initial load
duke
parents:
diff changeset
1039 // part / total
a61af66fc99e Initial load
duke
parents:
diff changeset
1040 // Don't align the results.
a61af66fc99e Initial load
duke
parents:
diff changeset
1041
a61af66fc99e Initial load
duke
parents:
diff changeset
1042 size_t PSAdaptiveSizePolicy::scale_down(size_t change,
a61af66fc99e Initial load
duke
parents:
diff changeset
1043 double part,
a61af66fc99e Initial load
duke
parents:
diff changeset
1044 double total) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1045 assert(part <= total, "Inconsistent input");
a61af66fc99e Initial load
duke
parents:
diff changeset
1046 size_t reduced_change = change;
a61af66fc99e Initial load
duke
parents:
diff changeset
1047 if (total > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1048 double fraction = part / total;
a61af66fc99e Initial load
duke
parents:
diff changeset
1049 reduced_change = (size_t) (fraction * (double) change);
a61af66fc99e Initial load
duke
parents:
diff changeset
1050 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1051 assert(reduced_change <= change, "Inconsistent result");
a61af66fc99e Initial load
duke
parents:
diff changeset
1052 return reduced_change;
a61af66fc99e Initial load
duke
parents:
diff changeset
1053 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1054
a61af66fc99e Initial load
duke
parents:
diff changeset
1055 size_t PSAdaptiveSizePolicy::eden_increment(size_t cur_eden,
a61af66fc99e Initial load
duke
parents:
diff changeset
1056 uint percent_change) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1057 size_t eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1058 eden_heap_delta = cur_eden / 100 * percent_change;
a61af66fc99e Initial load
duke
parents:
diff changeset
1059 return eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1060 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1061
a61af66fc99e Initial load
duke
parents:
diff changeset
1062 size_t PSAdaptiveSizePolicy::eden_increment(size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1063 return eden_increment(cur_eden, YoungGenerationSizeIncrement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1064 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1065
a61af66fc99e Initial load
duke
parents:
diff changeset
1066 size_t PSAdaptiveSizePolicy::eden_increment_aligned_up(size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1067 size_t result = eden_increment(cur_eden, YoungGenerationSizeIncrement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1068 return align_size_up(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1069 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1070
a61af66fc99e Initial load
duke
parents:
diff changeset
1071 size_t PSAdaptiveSizePolicy::eden_increment_aligned_down(size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1072 size_t result = eden_increment(cur_eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
1073 return align_size_down(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1074 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1075
a61af66fc99e Initial load
duke
parents:
diff changeset
1076 size_t PSAdaptiveSizePolicy::eden_increment_with_supplement_aligned_up(
a61af66fc99e Initial load
duke
parents:
diff changeset
1077 size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1078 size_t result = eden_increment(cur_eden,
a61af66fc99e Initial load
duke
parents:
diff changeset
1079 YoungGenerationSizeIncrement + _young_gen_size_increment_supplement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1080 return align_size_up(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1081 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1082
a61af66fc99e Initial load
duke
parents:
diff changeset
1083 size_t PSAdaptiveSizePolicy::eden_decrement_aligned_down(size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1084 size_t eden_heap_delta = eden_decrement(cur_eden);
a61af66fc99e Initial load
duke
parents:
diff changeset
1085 return align_size_down(eden_heap_delta, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1086 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1087
a61af66fc99e Initial load
duke
parents:
diff changeset
1088 size_t PSAdaptiveSizePolicy::eden_decrement(size_t cur_eden) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1089 size_t eden_heap_delta = eden_increment(cur_eden) /
a61af66fc99e Initial load
duke
parents:
diff changeset
1090 AdaptiveSizeDecrementScaleFactor;
a61af66fc99e Initial load
duke
parents:
diff changeset
1091 return eden_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1092 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1093
a61af66fc99e Initial load
duke
parents:
diff changeset
1094 size_t PSAdaptiveSizePolicy::promo_increment(size_t cur_promo,
a61af66fc99e Initial load
duke
parents:
diff changeset
1095 uint percent_change) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1096 size_t promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1097 promo_heap_delta = cur_promo / 100 * percent_change;
a61af66fc99e Initial load
duke
parents:
diff changeset
1098 return promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1099 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1100
a61af66fc99e Initial load
duke
parents:
diff changeset
1101 size_t PSAdaptiveSizePolicy::promo_increment(size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1102 return promo_increment(cur_promo, TenuredGenerationSizeIncrement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1104
a61af66fc99e Initial load
duke
parents:
diff changeset
1105 size_t PSAdaptiveSizePolicy::promo_increment_aligned_up(size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1106 size_t result = promo_increment(cur_promo, TenuredGenerationSizeIncrement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1107 return align_size_up(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1109
a61af66fc99e Initial load
duke
parents:
diff changeset
1110 size_t PSAdaptiveSizePolicy::promo_increment_aligned_down(size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1111 size_t result = promo_increment(cur_promo, TenuredGenerationSizeIncrement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1112 return align_size_down(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1114
a61af66fc99e Initial load
duke
parents:
diff changeset
1115 size_t PSAdaptiveSizePolicy::promo_increment_with_supplement_aligned_up(
a61af66fc99e Initial load
duke
parents:
diff changeset
1116 size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1117 size_t result = promo_increment(cur_promo,
a61af66fc99e Initial load
duke
parents:
diff changeset
1118 TenuredGenerationSizeIncrement + _old_gen_size_increment_supplement);
a61af66fc99e Initial load
duke
parents:
diff changeset
1119 return align_size_up(result, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1121
a61af66fc99e Initial load
duke
parents:
diff changeset
1122 size_t PSAdaptiveSizePolicy::promo_decrement_aligned_down(size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1123 size_t promo_heap_delta = promo_decrement(cur_promo);
a61af66fc99e Initial load
duke
parents:
diff changeset
1124 return align_size_down(promo_heap_delta, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1125 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1126
a61af66fc99e Initial load
duke
parents:
diff changeset
1127 size_t PSAdaptiveSizePolicy::promo_decrement(size_t cur_promo) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1128 size_t promo_heap_delta = promo_increment(cur_promo);
a61af66fc99e Initial load
duke
parents:
diff changeset
1129 promo_heap_delta = promo_heap_delta / AdaptiveSizeDecrementScaleFactor;
a61af66fc99e Initial load
duke
parents:
diff changeset
1130 return promo_heap_delta;
a61af66fc99e Initial load
duke
parents:
diff changeset
1131 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1132
6818
22b8d3d181d9 8000351: Tenuring threshold should be unsigned
jwilhelm
parents: 6725
diff changeset
1133 uint PSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold(
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1134 bool is_survivor_overflow,
6818
22b8d3d181d9 8000351: Tenuring threshold should be unsigned
jwilhelm
parents: 6725
diff changeset
1135 uint tenuring_threshold,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1136 size_t survivor_limit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1137 assert(survivor_limit >= _intra_generation_alignment,
a61af66fc99e Initial load
duke
parents:
diff changeset
1138 "survivor_limit too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
1139 assert((size_t)align_size_down(survivor_limit, _intra_generation_alignment)
a61af66fc99e Initial load
duke
parents:
diff changeset
1140 == survivor_limit, "survivor_limit not aligned");
a61af66fc99e Initial load
duke
parents:
diff changeset
1141
a61af66fc99e Initial load
duke
parents:
diff changeset
1142 // This method is called even if the tenuring threshold and survivor
a61af66fc99e Initial load
duke
parents:
diff changeset
1143 // spaces are not adjusted so that the averages are sampled above.
a61af66fc99e Initial load
duke
parents:
diff changeset
1144 if (!UsePSAdaptiveSurvivorSizePolicy ||
a61af66fc99e Initial load
duke
parents:
diff changeset
1145 !young_gen_policy_is_ready()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1146 return tenuring_threshold;
a61af66fc99e Initial load
duke
parents:
diff changeset
1147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1148
a61af66fc99e Initial load
duke
parents:
diff changeset
1149 // We'll decide whether to increase or decrease the tenuring
a61af66fc99e Initial load
duke
parents:
diff changeset
1150 // threshold based partly on the newly computed survivor size
a61af66fc99e Initial load
duke
parents:
diff changeset
1151 // (if we hit the maximum limit allowed, we'll always choose to
a61af66fc99e Initial load
duke
parents:
diff changeset
1152 // decrement the threshold).
a61af66fc99e Initial load
duke
parents:
diff changeset
1153 bool incr_tenuring_threshold = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
1154 bool decr_tenuring_threshold = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
1155
a61af66fc99e Initial load
duke
parents:
diff changeset
1156 set_decrement_tenuring_threshold_for_gc_cost(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1157 set_increment_tenuring_threshold_for_gc_cost(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1158 set_decrement_tenuring_threshold_for_survivor_limit(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
1159
a61af66fc99e Initial load
duke
parents:
diff changeset
1160 if (!is_survivor_overflow) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1161 // Keep running averages on how much survived
a61af66fc99e Initial load
duke
parents:
diff changeset
1162
a61af66fc99e Initial load
duke
parents:
diff changeset
1163 // We use the tenuring threshold to equalize the cost of major
a61af66fc99e Initial load
duke
parents:
diff changeset
1164 // and minor collections.
a61af66fc99e Initial load
duke
parents:
diff changeset
1165 // ThresholdTolerance is used to indicate how sensitive the
a61af66fc99e Initial load
duke
parents:
diff changeset
1166 // tenuring threshold is to differences in cost betweent the
a61af66fc99e Initial load
duke
parents:
diff changeset
1167 // collection types.
a61af66fc99e Initial load
duke
parents:
diff changeset
1168
a61af66fc99e Initial load
duke
parents:
diff changeset
1169 // Get the times of interest. This involves a little work, so
a61af66fc99e Initial load
duke
parents:
diff changeset
1170 // we cache the values here.
a61af66fc99e Initial load
duke
parents:
diff changeset
1171 const double major_cost = major_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
1172 const double minor_cost = minor_gc_cost();
a61af66fc99e Initial load
duke
parents:
diff changeset
1173
a61af66fc99e Initial load
duke
parents:
diff changeset
1174 if (minor_cost > major_cost * _threshold_tolerance_percent) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1175 // Minor times are getting too long; lower the threshold so
a61af66fc99e Initial load
duke
parents:
diff changeset
1176 // less survives and more is promoted.
a61af66fc99e Initial load
duke
parents:
diff changeset
1177 decr_tenuring_threshold = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
1178 set_decrement_tenuring_threshold_for_gc_cost(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1179 } else if (major_cost > minor_cost * _threshold_tolerance_percent) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1180 // Major times are too long, so we want less promotion.
a61af66fc99e Initial load
duke
parents:
diff changeset
1181 incr_tenuring_threshold = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
1182 set_increment_tenuring_threshold_for_gc_cost(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1184
a61af66fc99e Initial load
duke
parents:
diff changeset
1185 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
1186 // Survivor space overflow occurred, so promoted and survived are
a61af66fc99e Initial load
duke
parents:
diff changeset
1187 // not accurate. We'll make our best guess by combining survived
a61af66fc99e Initial load
duke
parents:
diff changeset
1188 // and promoted and count them as survivors.
a61af66fc99e Initial load
duke
parents:
diff changeset
1189 //
a61af66fc99e Initial load
duke
parents:
diff changeset
1190 // We'll lower the tenuring threshold to see if we can correct
a61af66fc99e Initial load
duke
parents:
diff changeset
1191 // things. Also, set the survivor size conservatively. We're
a61af66fc99e Initial load
duke
parents:
diff changeset
1192 // trying to avoid many overflows from occurring if defnew size
a61af66fc99e Initial load
duke
parents:
diff changeset
1193 // is just too small.
a61af66fc99e Initial load
duke
parents:
diff changeset
1194
a61af66fc99e Initial load
duke
parents:
diff changeset
1195 decr_tenuring_threshold = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
1196 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1197
a61af66fc99e Initial load
duke
parents:
diff changeset
1198 // The padded average also maintains a deviation from the average;
a61af66fc99e Initial load
duke
parents:
diff changeset
1199 // we use this to see how good of an estimate we have of what survived.
a61af66fc99e Initial load
duke
parents:
diff changeset
1200 // We're trying to pad the survivor size as little as possible without
a61af66fc99e Initial load
duke
parents:
diff changeset
1201 // overflowing the survivor spaces.
a61af66fc99e Initial load
duke
parents:
diff changeset
1202 size_t target_size = align_size_up((size_t)_avg_survived->padded_average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
1203 _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1204 target_size = MAX2(target_size, _intra_generation_alignment);
a61af66fc99e Initial load
duke
parents:
diff changeset
1205
a61af66fc99e Initial load
duke
parents:
diff changeset
1206 if (target_size > survivor_limit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1207 // Target size is bigger than we can handle. Let's also reduce
a61af66fc99e Initial load
duke
parents:
diff changeset
1208 // the tenuring threshold.
a61af66fc99e Initial load
duke
parents:
diff changeset
1209 target_size = survivor_limit;
a61af66fc99e Initial load
duke
parents:
diff changeset
1210 decr_tenuring_threshold = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
1211 set_decrement_tenuring_threshold_for_survivor_limit(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
1212 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1213
a61af66fc99e Initial load
duke
parents:
diff changeset
1214 // Finally, increment or decrement the tenuring threshold, as decided above.
a61af66fc99e Initial load
duke
parents:
diff changeset
1215 // We test for decrementing first, as we might have hit the target size
a61af66fc99e Initial load
duke
parents:
diff changeset
1216 // limit.
a61af66fc99e Initial load
duke
parents:
diff changeset
1217 if (decr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1218 if (tenuring_threshold > 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1219 tenuring_threshold--;
a61af66fc99e Initial load
duke
parents:
diff changeset
1220 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1221 } else if (incr_tenuring_threshold && !(AlwaysTenure || NeverTenure)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1222 if (tenuring_threshold < MaxTenuringThreshold) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1223 tenuring_threshold++;
a61af66fc99e Initial load
duke
parents:
diff changeset
1224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1226
a61af66fc99e Initial load
duke
parents:
diff changeset
1227 // We keep a running average of the amount promoted which is used
a61af66fc99e Initial load
duke
parents:
diff changeset
1228 // to decide when we should collect the old generation (when
a61af66fc99e Initial load
duke
parents:
diff changeset
1229 // the amount of old gen free space is less than what we expect to
a61af66fc99e Initial load
duke
parents:
diff changeset
1230 // promote).
a61af66fc99e Initial load
duke
parents:
diff changeset
1231
a61af66fc99e Initial load
duke
parents:
diff changeset
1232 if (PrintAdaptiveSizePolicy) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1233 // A little more detail if Verbose is on
a61af66fc99e Initial load
duke
parents:
diff changeset
1234 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1235 gclog_or_tty->print( " avg_survived: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
1236 " avg_deviation: %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
1237 _avg_survived->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
1238 _avg_survived->deviation());
a61af66fc99e Initial load
duke
parents:
diff changeset
1239 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1240
a61af66fc99e Initial load
duke
parents:
diff changeset
1241 gclog_or_tty->print( " avg_survived_padded_avg: %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
1242 _avg_survived->padded_average());
a61af66fc99e Initial load
duke
parents:
diff changeset
1243
a61af66fc99e Initial load
duke
parents:
diff changeset
1244 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1245 gclog_or_tty->print( " avg_promoted_avg: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
1246 " avg_promoted_dev: %f",
a61af66fc99e Initial load
duke
parents:
diff changeset
1247 avg_promoted()->average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
1248 avg_promoted()->deviation());
a61af66fc99e Initial load
duke
parents:
diff changeset
1249 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1250
10993
493089fd29df 8015903: Format issue with -XX:+PrintAdaptiveSizePolicy on JDK8
poonam
parents: 10359
diff changeset
1251 gclog_or_tty->print_cr( " avg_promoted_padded_avg: %f"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1252 " avg_pretenured_padded_avg: %f"
a61af66fc99e Initial load
duke
parents:
diff changeset
1253 " tenuring_thresh: %d"
a61af66fc99e Initial load
duke
parents:
diff changeset
1254 " target_size: " SIZE_FORMAT,
a61af66fc99e Initial load
duke
parents:
diff changeset
1255 avg_promoted()->padded_average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
1256 _avg_pretenured->padded_average(),
a61af66fc99e Initial load
duke
parents:
diff changeset
1257 tenuring_threshold, target_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
1258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1259
a61af66fc99e Initial load
duke
parents:
diff changeset
1260 set_survivor_size(target_size);
a61af66fc99e Initial load
duke
parents:
diff changeset
1261
a61af66fc99e Initial load
duke
parents:
diff changeset
1262 return tenuring_threshold;
a61af66fc99e Initial load
duke
parents:
diff changeset
1263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1264
a61af66fc99e Initial load
duke
parents:
diff changeset
1265 void PSAdaptiveSizePolicy::update_averages(bool is_survivor_overflow,
a61af66fc99e Initial load
duke
parents:
diff changeset
1266 size_t survived,
a61af66fc99e Initial load
duke
parents:
diff changeset
1267 size_t promoted) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1268 // Update averages
a61af66fc99e Initial load
duke
parents:
diff changeset
1269 if (!is_survivor_overflow) {
a61af66fc99e Initial load
duke
parents:
diff changeset
1270 // Keep running averages on how much survived
a61af66fc99e Initial load
duke
parents:
diff changeset
1271 _avg_survived->sample(survived);
a61af66fc99e Initial load
duke
parents:
diff changeset
1272 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
1273 size_t survived_guess = survived + promoted;
a61af66fc99e Initial load
duke
parents:
diff changeset
1274 _avg_survived->sample(survived_guess);
a61af66fc99e Initial load
duke
parents:
diff changeset
1275 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1276 avg_promoted()->sample(promoted + _avg_pretenured->padded_average());
a61af66fc99e Initial load
duke
parents:
diff changeset
1277
a61af66fc99e Initial load
duke
parents:
diff changeset
1278 if (PrintAdaptiveSizePolicy) {
10993
493089fd29df 8015903: Format issue with -XX:+PrintAdaptiveSizePolicy on JDK8
poonam
parents: 10359
diff changeset
1279 gclog_or_tty->print_cr(
10359
14d3f71f831d 8007762: Rename a bunch of methods in size policy across collectors
tamao
parents: 10288
diff changeset
1280 "AdaptiveSizePolicy::update_averages:"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1281 " survived: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
1282 " promoted: " SIZE_FORMAT
a61af66fc99e Initial load
duke
parents:
diff changeset
1283 " overflow: %s",
a61af66fc99e Initial load
duke
parents:
diff changeset
1284 survived, promoted, is_survivor_overflow ? "true" : "false");
a61af66fc99e Initial load
duke
parents:
diff changeset
1285 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1286 }
a61af66fc99e Initial load
duke
parents:
diff changeset
1287
a61af66fc99e Initial load
duke
parents:
diff changeset
1288 bool PSAdaptiveSizePolicy::print_adaptive_size_policy_on(outputStream* st)
a61af66fc99e Initial load
duke
parents:
diff changeset
1289 const {
a61af66fc99e Initial load
duke
parents:
diff changeset
1290
a61af66fc99e Initial load
duke
parents:
diff changeset
1291 if (!UseAdaptiveSizePolicy) return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
1292
a61af66fc99e Initial load
duke
parents:
diff changeset
1293 return AdaptiveSizePolicy::print_adaptive_size_policy_on(
a61af66fc99e Initial load
duke
parents:
diff changeset
1294 st,
a61af66fc99e Initial load
duke
parents:
diff changeset
1295 PSScavenge::tenuring_threshold());
a61af66fc99e Initial load
duke
parents:
diff changeset
1296 }