From: Dmitriy Vyukov Date: Fri, 19 Jul 2013 13:45:34 +0000 (+0400) Subject: runtime: prevent sysmon from polling network excessivly X-Git-Tag: go1.2rc2~997 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=68572644576be5f1f7121428755e7d8af5b7044c;p=gostls13.git 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 --- diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index fe32f2c28b..18ddce8018 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -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); }