]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: prevent sysmon from polling network excessivly
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 19 Jul 2013 13:45:34 +0000 (17:45 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 19 Jul 2013 13:45:34 +0000 (17:45 +0400)
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

src/pkg/runtime/proc.c

index fe32f2c28b0416f50ec23a5282c891fd90d64646..18ddce80184268474601baf1999bd0fd8befa2c2 100644 (file)
@@ -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);
                }