From d434c2338b11b9ecf19865e8ec3f2721706f29cf Mon Sep 17 00:00:00 2001 From: zhengjianxun Date: Tue, 23 Feb 2021 03:12:56 +0000 Subject: [PATCH] runtime: clarify GC fractional mode description nowdays, in runtime/mgc.go,we can see the comment descrition : The fractional worker is necessary when GOMAXPROCS*gcBackgroundUtilization is not an integer. but it not true such as GOMAXPROCS=5. in the implemet of startCycle() , Fractional Mode happend only when GOMAXPROCS<=3 or GOMAXPROCS=6. so utilization can closest to 25%. Fixes #44380 Change-Id: Id0dd6d9f37759c2c9231f164a013a014216dd442 GitHub-Last-Rev: 5910e76324b2fa908235c325c8b1edafca496256 GitHub-Pull-Request: golang/go#44381 Reviewed-on: https://go-review.googlesource.com/c/go/+/293630 Reviewed-by: Austin Clements Trust: Michael Pratt --- src/runtime/mgc.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 185d3201ca2..7c7239beb8d 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -302,9 +302,11 @@ const ( // gcMarkWorkerFractionalMode indicates that a P is currently // running the "fractional" mark worker. The fractional worker // is necessary when GOMAXPROCS*gcBackgroundUtilization is not - // an integer. The fractional worker should run until it is - // preempted and will be scheduled to pick up the fractional - // part of GOMAXPROCS*gcBackgroundUtilization. + // an integer and using only dedicated workers would result in + // utilization too far from the target of gcBackgroundUtilization. + // The fractional worker should run until it is preempted and + // will be scheduled to pick up the fractional part of + // GOMAXPROCS*gcBackgroundUtilization. gcMarkWorkerFractionalMode // gcMarkWorkerIdleMode indicates that a P is running the mark