diff options
Diffstat (limited to 'src/runtime/mstats.go')
| -rw-r--r-- | src/runtime/mstats.go | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go index c8e5249156..3eff7f6b3e 100644 --- a/src/runtime/mstats.go +++ b/src/runtime/mstats.go @@ -153,24 +153,13 @@ func init() { // ReadMemStats populates m with memory allocator statistics. func ReadMemStats(m *MemStats) { - // Have to acquire worldsema to stop the world, - // because stoptheworld can only be used by - // one goroutine at a time, and there might be - // a pending garbage collection already calling it. - semacquire(&worldsema, false) - gp := getg() - gp.m.preemptoff = "read mem stats" - systemstack(stoptheworld) + stopTheWorld("read mem stats") systemstack(func() { readmemstats_m(m) }) - gp.m.preemptoff = "" - gp.m.locks++ - semrelease(&worldsema) - systemstack(starttheworld) - gp.m.locks-- + startTheWorld() } func readmemstats_m(stats *MemStats) { |
