]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.1] runtime: prevent sysmon from polling network excessivly
authorAndrew Gerrand <adg@golang.org>
Mon, 22 Jul 2013 23:50:35 +0000 (09:50 +1000)
committerAndrew Gerrand <adg@golang.org>
Mon, 22 Jul 2013 23:50:35 +0000 (09:50 +1000)
««« CL 11569043 / 6b3c351c7fe6
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  issue 5922 .

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/11569043
»»»

Update #5928

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/11438044

src/pkg/runtime/proc.c

index 5734509e0cca9502c427b96f5e9d0477b095e3a4..9ad2ea091bc46962f9c6d266c517e48d949bb689 100644 (file)
@@ -2015,6 +2015,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);
                }