mirror of
https://github.com/golang/go
synced 2024-11-26 14:36:52 -07:00
runtime: prevent sysmon from polling network excessivly
If the network is not polled for 10ms, sysmon starts polling network on every iteration (every 20us) until another thread blocks in netpoll. Fixes #5922. R=golang-dev, iant CC=golang-dev https://golang.org/cl/11569043
This commit is contained in:
parent
9bfb69187f
commit
6857264457
@ -2098,6 +2098,7 @@ sysmon(void)
|
||||
lastpoll = runtime·atomicload64(&runtime·sched.lastpoll);
|
||||
now = runtime·nanotime();
|
||||
if(lastpoll != 0 && lastpoll + 10*1000*1000 > now) {
|
||||
runtime·cas64(&runtime·sched.lastpoll, lastpoll, now);
|
||||
gp = runtime·netpoll(false); // non-blocking
|
||||
injectglist(gp);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user