-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: time management in OpenBSD port is wildly misconfigured #52475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Turns out, the only sleep this matters for is that |
Change https://go.dev/cl/401638 mentions this issue: |
Could this also (perhaps partially) explain #50189, or are the sleeping paths for |
I think that's plausible. This happens so deep in the runtime that it can basically happen any time. And it's on the work stealing path, so anything that's scheduler-heavy will likely exacerbate it. |
Change https://go.dev/cl/407139 mentions this issue: |
NetBSD appears to have the same issue OpenBSD had in runqgrab. See issue #52475 for more details. For #35166. Change-Id: Ie53192d26919b4717bc0d61cadd88d688ff38bb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/407139 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
In the Go runtime, on most platforms, we generally assume that thread-level sleeps (and other time-based things) try to wake up in an amount of time that's somewhere close to what we pass. The one exception here, across the runtime, is Windows. For Windows, we query interrupt time because it's more efficient, and work around sleeps that rounded to a clock with coarse granularity.
OpenBSD has a coarse-granularity clock for sleeps, but the runtime doesn't act like it. (Thanks @prattmic for digging up these links!) That results in situations like this one:
The above text is a GC trace for
TestDecodeMemoryConsumption
in theimage/gif
package. Note the very high GC stop-the-world times for the transition to the mark phase. This is time not spent in the pause, but actually trying to stop the world:Typically the runtime is waiting on one P, and it goes to sleep on a note for 100µs. If undisturbed, it takes between 10 and 20 ms to actually wake up. But that should be OK, because it's woken up early if the last P to stop actually stops. Except that we have thread-level sleeps in other parts of the runtime that have the same latency! For example,
runqgrab
might callusleep(3)
, but that too takes 10-20ms to return. This was a common one I discovered (and confirmed as a source of latency) and there are sure to be more.The runtime needs to be overhauled for the OpenBSD port to treat sleeps as we would on Windows.
This is closely related to #14183.
The text was updated successfully, but these errors were encountered: