From e5a4211b36ca776189730de6f1ab4403dde46f46 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Tue, 11 Feb 2014 13:41:46 +0400 Subject: [PATCH] runtime: do not profile blocked netpoll on windows There is frequently a thread hanging on GQCS, currently it skews profiles towards netpoll, but it is not bad and is not consuming any resources. R=alex.brainman CC=golang-codereviews https://golang.org/cl/61560043 --- src/pkg/runtime/netpoll_windows.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pkg/runtime/netpoll_windows.c b/src/pkg/runtime/netpoll_windows.c index b510a41e26..aeb065148c 100644 --- a/src/pkg/runtime/netpoll_windows.c +++ b/src/pkg/runtime/netpoll_windows.c @@ -94,13 +94,17 @@ retry: n = nelem(entries) / runtime·gomaxprocs; if(n < 8) n = 8; + if(block) + m->blocked = true; if(runtime·stdcall(runtime·GetQueuedCompletionStatusEx, 6, iocphandle, entries, (uintptr)n, &n, (uintptr)wait, (uintptr)0) == 0) { + m->blocked = false; errno = runtime·getlasterror(); if(!block && errno == WAIT_TIMEOUT) return nil; runtime·printf("netpoll: GetQueuedCompletionStatusEx failed (errno=%d)\n", errno); runtime·throw("netpoll: GetQueuedCompletionStatusEx failed"); } + m->blocked = false; for(i = 0; i < n; i++) { op = entries[i].op; errno = 0; @@ -113,7 +117,10 @@ retry: op = nil; errno = 0; qty = 0; + if(block) + m->blocked = true; if(runtime·stdcall(runtime·GetQueuedCompletionStatus, 5, iocphandle, &qty, &key, &op, (uintptr)wait) == 0) { + m->blocked = false; errno = runtime·getlasterror(); if(!block && errno == WAIT_TIMEOUT) return nil; @@ -123,6 +130,7 @@ retry: } // dequeued failed IO packet, so report that } + m->blocked = false; handlecompletion(&gp, op, errno, qty); } if(block && gp == nil) -- 2.48.1