]> Cypherpunks repositories - gostls13.git/commit
runtime: turn off scavenger when there's <1 physical page of work
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 25 Oct 2019 18:23:35 +0000 (18:23 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 1 Nov 2019 21:32:33 +0000 (21:32 +0000)
commit08a72c851c782a5a0190c1647283432a1bb09889
tree4c91817c99e21dda84640b2696ab7f96b0b04027
parentd0160bc32defcb054b59b8501bfadc8ec5b64073
runtime: turn off scavenger when there's <1 physical page of work

This change turns off the scavenger if there's less than one physical
page of work to do. If there's less than one phyiscal page of work
today, then the computed time for the work to be done will be zero,
resulting in a floating point division by zero.

This is bad on two accounts. On the one hand it could cause a fault on
some systems. On the other hand, it could cause the pacing computations
done by the scavenger to be nonsense. While this is generally harmless
in the case where there's a very small amount of work to do anyway (the
scavenger might just back off expontentially forever, or do some work
and immediately sleep, because there's not much of it to do), it causes
problems for the deadlock checker. On platforms with a larger physical
page size, such as 64 KiB, we might hit this path in a deadlock
scenario, in which case the deadlock checker will never fire and we'll
just hang.

Specifically, this happens on ppc64 trybot tests, which is where the
issue was discovered.

Fixes #34575.

Change-Id: I8677db539447b2f0e75b8cfcbe33932244e1508c
Reviewed-on: https://go-review.googlesource.com/c/go/+/203517
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/mgcscavenge.go