8232001: ZGC: Ignore metaspace GC threshold until GC is warm

Reviewed-by: eosterlund
This commit is contained in:
Per Lidén 2019-10-21 09:51:24 +02:00
parent b404ddd9a2
commit f751808df9
5 changed files with 20 additions and 15 deletions

View File

@ -48,14 +48,6 @@ void ZDirector::sample_allocation_rate() const {
ZStatAllocRate::avg_sd() / M);
}
bool ZDirector::is_first() const {
return ZStatCycle::ncycles() == 0;
}
bool ZDirector::is_warm() const {
return ZStatCycle::ncycles() >= 3;
}
bool ZDirector::rule_timer() const {
if (ZCollectionInterval == 0) {
// Rule disabled
@ -73,7 +65,7 @@ bool ZDirector::rule_timer() const {
}
bool ZDirector::rule_warmup() const {
if (is_warm()) {
if (ZStatCycle::is_warm()) {
// Rule disabled
return false;
}
@ -93,7 +85,7 @@ bool ZDirector::rule_warmup() const {
}
bool ZDirector::rule_allocation_rate() const {
if (is_first()) {
if (ZStatCycle::is_first()) {
// Rule disabled
return false;
}
@ -140,7 +132,7 @@ bool ZDirector::rule_allocation_rate() const {
}
bool ZDirector::rule_proactive() const {
if (!ZProactive || !is_warm()) {
if (!ZProactive || !ZStatCycle::is_warm()) {
// Rule disabled
return false;
}

View File

@ -36,9 +36,6 @@ private:
void sample_allocation_rate() const;
bool is_first() const;
bool is_warm() const;
bool rule_timer() const;
bool rule_warmup() const;
bool rule_allocation_rate() const;

View File

@ -250,11 +250,17 @@ void ZDriver::collect(GCCause::Cause cause) {
case GCCause::_z_allocation_stall:
case GCCause::_z_proactive:
case GCCause::_z_high_usage:
case GCCause::_metadata_GC_threshold:
// Start asynchronous GC
_gc_cycle_port.send_async(cause);
break;
case GCCause::_metadata_GC_threshold:
// Start asynchronous GC, but only if the GC is warm
if (ZStatCycle::is_warm()) {
_gc_cycle_port.send_async(cause);
}
break;
case GCCause::_gc_locker:
// Restart VM operation previously blocked by the GC locker
_gc_locker_port.signal();

View File

@ -1049,6 +1049,14 @@ void ZStatCycle::at_end(double boost_factor) {
_normalized_duration.add(normalized_duration);
}
bool ZStatCycle::is_first() {
return _ncycles == 0;
}
bool ZStatCycle::is_warm() {
return _ncycles >= 3;
}
uint64_t ZStatCycle::ncycles() {
return _ncycles;
}

View File

@ -374,6 +374,8 @@ public:
static void at_start();
static void at_end(double boost_factor);
static bool is_first();
static bool is_warm();
static uint64_t ncycles();
static const AbsSeq& normalized_duration();
static double time_since_last();