]> Cypherpunks repositories - gostls13.git/commit
runtime: don't lock mheap on user goroutine
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 23 Jul 2014 14:52:25 +0000 (18:52 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 23 Jul 2014 14:52:25 +0000 (18:52 +0400)
commite91704af275fc6dcbad8f94fd11baadeb062e50e
tree856ed7269e5d63974ae4c43dc346863bfb9d4b7c
parent0603fbb01ca3778c08c0a445cd84195dbdc8fb3b
runtime: don't lock mheap on user goroutine
This is bad for 2 reasons:
1. if the code under lock ever grows stack,
it will deadlock as stack growing acquires mheap lock.
2. It currently deadlocks with SetCPUProfileRate:
scavenger locks mheap, receives prof signal and tries to lock prof lock;
meanwhile SetCPUProfileRate locks prof lock and tries to grow stack
(presumably in runtime.unlock->futexwakeup). Boom.
Let's assume that it
Fixes #8407.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews, khr
https://golang.org/cl/112640043
src/pkg/runtime/mheap.c