Skip to content

Commit

Permalink
runtime: prevent sysmon from polling network excessivly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dvyukov committed Jul 19, 2013
1 parent 9bfb691 commit 6857264
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/pkg/runtime/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 6857264

Please sign in to comment.