From 2919132e1b7ade3faa394339d3199f243103dd72 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Thu, 30 Mar 2017 14:59:53 -0400 Subject: [PATCH] runtime: don't adjust GC trigger on forced GC Forced GCs don't provide good information about how to adjust the GC trigger. Currently we avoid adjusting the trigger on forced GC because forced GC is also STW and we don't adjust the trigger on STW GC. However, this will become a problem when forced GC is concurrent. Fix this by skipping trigger adjustment if the GC was user-forced. For #18216. Change-Id: I03dfdad12ecd3cfeca4573140a0768abb29aac5e Reviewed-on: https://go-review.googlesource.com/38951 Run-TryBot: Austin Clements TryBot-Result: Gobot Gobot Reviewed-by: Rick Hudson --- src/runtime/mgc.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index ba7cf9cb14..9f59d8fa75 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -552,6 +552,13 @@ func (c *gcControllerState) revise() { // endCycle updates the GC controller state at the end of the // concurrent part of the GC cycle. func (c *gcControllerState) endCycle() { + if work.userForced { + // Forced GC means this cycle didn't start at the + // trigger, so where it finished isn't good + // information about how to adjust the trigger. + return + } + h_t := c.triggerRatio // For debugging // Proportional response gain for the trigger controller. Must