summaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorRick Hudson <rlh@golang.org>2014-10-24 11:07:16 -0400
committerRick Hudson <rlh@golang.org>2014-10-24 11:07:16 -0400
commit2c987a9ddefd9d256bf9e7e21396e2485a7d6514 (patch)
tree856e4b1fb53139120ce60e1724361a749c7e2afe /src/runtime/malloc.go
parent978c971bacf92ee97b8e24ce45b485afa1c31fad (diff)
downloadgo-2c987a9ddefd9d256bf9e7e21396e2485a7d6514.tar.gz
[dev.garbage] runtime: Concurrent scan code
Routines and logic to preform a concurrent stack scan of go-routines. This CL excersizes most of the functionality needed. The major exception being that it does not scan running goroutines. After doing the scans it relies on a STW to finish the GC, including rescanning the stacks. It is intended to achieve correctness, performance will follow. LGTM=rsc R=golang-codereviews, rsc CC=dvyukov, golang-codereviews https://codereview.appspot.com/156580043
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 9b4264f2b..c56e03886 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -438,7 +438,15 @@ func gogc(force int32) {
mp = acquirem()
mp.gcing = 1
releasem(mp)
+
onM(stoptheworld)
+ onM(finishsweep_m) // finish sweep before we start concurrent scan.
+ onM(starttheworld)
+
+ // Do a concurrent heap scan before we stop the world.
+ onM(gcscan_m)
+ onM(stoptheworld)
+
if mp != acquirem() {
gothrow("gogc: rescheduled")
}