• Dmitriy Vyukov's avatar
    runtime: fix deadlock · cb945ba6
    Dmitriy Vyukov authored
    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
    cb945ba6
proc.c 52.6 KB