6937160: G1: should observe GCTimeRatio
authortonyp
Tue Mar 30 15:36:55 2010 -0400 (3 years ago)
changeset 165156507bcd639e
parent 16324b60f23c4223
child 1652781e29eb8e08
6937160: G1: should observe GCTimeRatio
Summary: Remove the G1GCPercent parameter, that specifies the desired GC overhead percentage in G1, and observe the GCTimeRatio parameter instead.
Reviewed-by: jmasa, johnc
src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
src/share/vm/gc_implementation/g1/g1_globals.hpp
src/share/vm/runtime/arguments.cpp
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Thu Apr 01 20:48:50 2010 -0400
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Tue Mar 30 15:36:55 2010 -0400
@@ -198,7 +198,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_recorded_survivor_regions(0),
_recorded_survivor_head(NULL),
_recorded_survivor_tail(NULL),
- _survivors_age_table(true)
+ _survivors_age_table(true),
+
+ _gc_overhead_perc(0.0)
{
// Set up the region size and associated fields. Given that the
@@ -274,6 +276,11 @@ G1CollectorPolicy::G1CollectorPolicy() :
// fixed, then _max_survivor_regions will be calculated at
// calculate_young_list_target_config during initialization
_max_survivor_regions = G1FixedSurvivorSpaceSize / HeapRegion::GrainBytes;
+
+ assert(GCTimeRatio > 0,
+ "we should have set it to a default value set_g1_gc_flags() "
+ "if a user set it to 0");
+ _gc_overhead_perc = 100.0 * (1.0 / (1.0 + GCTimeRatio));
initialize_all();
}
@@ -2288,7 +2295,7 @@ G1CollectorPolicy::conservative_avg_surv
}
size_t G1CollectorPolicy::expansion_amount() {
- if ((int)(recent_avg_pause_time_ratio() * 100.0) > G1GCPercent) {
+ if ((recent_avg_pause_time_ratio() * 100.0) > _gc_overhead_perc) {
// We will double the existing space, or take
// G1ExpandByPercentOfAvailable % of the available expansion
// space, whichever is smaller, bounded below by a minimum
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Thu Apr 01 20:48:50 2010 -0400
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Tue Mar 30 15:36:55 2010 -0400
@@ -215,6 +215,8 @@ protected:
SurvRateGroup* _survivor_surv_rate_group;
// add here any more surv rate groups
+ double _gc_overhead_perc;
+
bool during_marking() {
return _during_marking;
}
--- a/src/share/vm/gc_implementation/g1/g1_globals.hpp Thu Apr 01 20:48:50 2010 -0400
+++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp Tue Mar 30 15:36:55 2010 -0400
@@ -40,9 +40,6 @@
develop(bool, G1Gen, true, \
"If true, it will enable the generational G1") \
\
- develop(intx, G1GCPercent, 10, \
- "The desired percent time spent on GC") \
- \
develop(intx, G1PolicyVerbose, 0, \
"The verbosity level on G1 policy decisions") \
\
--- a/src/share/vm/runtime/arguments.cpp Thu Apr 01 20:48:50 2010 -0400
+++ b/src/share/vm/runtime/arguments.cpp Tue Mar 30 15:36:55 2010 -0400
@@ -1352,6 +1352,16 @@ void Arguments::set_g1_gc_flags() {
tty->print_cr("MarkStackSize: %uk MarkStackSizeMax: %uk",
MarkStackSize / K, MarkStackSizeMax / K);
tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+ }
+
+ if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
+ // In G1, we want the default GC overhead goal to be higher than
+ // say in PS. So we set it here to 10%. Otherwise the heap might
+ // be expanded more aggressively than we would like it to. In
+ // fact, even 10% seems to not be high enough in some cases
+ // (especially small GC stress tests that the main thing they do
+ // is allocation). We might consider increase it further.
+ FLAG_SET_DEFAULT(GCTimeRatio, 9);
}
}