]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: do not profile blocked netpoll on windows
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 11 Feb 2014 09:41:46 +0000 (13:41 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 11 Feb 2014 09:41:46 +0000 (13:41 +0400)
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

index b510a41e26f5d77cc37cf9e2755f7260a532cf31..aeb065148cee7ec0e153b086d5ad5e03a7c34f80 100644 (file)
@@ -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)