From f3ec83e45b3c6f7f3183c2726701dccd11a00550 Mon Sep 17 00:00:00 2001 Date: Wed, 3 Jun 2020 09:39:34 +0000 Subject: [PATCH] ZGC: correct free heap size excluding waste in rule_allocation_rate Summary: : LLT: Bug url: --- src/hotspot/share/gc/z/zDirector.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/hotspot/share/gc/z/zDirector.cpp b/src/hotspot/share/gc/z/zDirector.cpp index 209bf0a..6f894c3 100644 --- a/src/hotspot/share/gc/z/zDirector.cpp +++ b/src/hotspot/share/gc/z/zDirector.cpp @@ -120,7 +120,9 @@ bool ZDirector::rule_allocation_rate() const { // the allocation rate variance, which means the probability is 1 in 1000 // that a sample is outside of the confidence interval. const double max_alloc_rate = (ZStatAllocRate::avg() * ZAllocationSpikeTolerance) + (ZStatAllocRate::avg_sd() * one_in_1000); - const double time_until_oom = free / (max_alloc_rate + 1.0); // Plus 1.0B/s to avoid division by zero + + // Plus 1.0B/s to avoid division by zero. Small or medium page allow 12.5% waste, so 87.5% used. + const double time_until_oom = (0.875 * free) / (max_alloc_rate + 1.0); // Calculate max duration of a GC cycle. The duration of GC is a moving // average, we add ~3.3 sigma to account for the GC duration variance. -- 1.8.3.1