From 2425a2e32f57a5df3a048a06431089fd83e8cec9 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 18 Jul 2014 13:05:21 +0400 Subject: [PATCH] runtime: fix gctrace=1 updatememstats is called on both the m and g stacks. Call into flushallmcaches correctly. flushallmcaches can only run on the M stack. This is somewhat temporary. once ReadMemStats is in Go we can have all of this code M-only. LGTM=dvyukov R=golang-codereviews, dvyukov CC=golang-codereviews https://golang.org/cl/116880043 --- src/pkg/runtime/mgc0.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 8b9779da6b..2d478acdc4 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -2172,7 +2172,10 @@ runtime·updatememstats(GCStats *stats) } // Flush MCache's to MCentral. - runtime·mcall(flushallmcaches_m); + if(g == g->m->g0) + flushallmcaches(); + else + runtime·mcall(flushallmcaches_m); // Aggregate local stats. cachestats();