]> Cypherpunks repositories - gostls13.git/commit
runtime: fix deadlock
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 7 Mar 2013 17:39:59 +0000 (21:39 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 7 Mar 2013 17:39:59 +0000 (21:39 +0400)
commitcb945ba6ba23772336bf02fd2364c3df9e9233e0
treee23a0cd212bf9b2a3bc6a8e1f3e819d4ea87329d
parent60f783d92bc07fa7ca78e8efccbbc841d9f9cbcb
runtime: fix deadlock
The deadlock episodically occurs on misc/cgo/test/TestCthread.
The problem is that starttheworld() leaves some P's with local work
without M's. Then all active M's enter into syscalls, but reject to
wake another M's due to the following check (both in entersyscallblock() and in retake()):
if(p->runqhead == p->runqtail &&
        runtime·atomicload(&runtime·sched.nmspinning) +
        runtime·atomicload(&runtime·sched.npidle) > 0)
        continue;

R=rsc
CC=golang-dev
https://golang.org/cl/7424054
src/pkg/runtime/proc.c