runtime: check for preemption due to garbage collection
in various already expensive routines.
helps keep cpu utilization up when GOMAXPROCS > 1,
but not a full solution.
http://groups.google.com/group/golang-nuts/t/7a9535c4136d3e2
R=r
CC=golang-dev
https://golang.org/cl/184043
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 6ac4090..6324b4b 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -14,6 +14,8 @@
static int32 debug = 0;
+int32 gcwaiting;
+
// Go scheduler
//
// The go scheduler's job is to match ready-to-run goroutines (`g's)
@@ -362,6 +364,7 @@
stoptheworld(void)
{
lock(&sched);
+ gcwaiting = 1;
sched.mcpumax = 1;
while(sched.mcpu > 1) {
noteclear(&sched.stopped);
@@ -379,6 +382,7 @@
starttheworld(void)
{
lock(&sched);
+ gcwaiting = 0;
sched.mcpumax = sched.gomaxprocs;
matchmg();
unlock(&sched);