aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-03-27 17:01:53 -0400
committerAustin Clements <austin@google.com>2015-04-27 19:26:37 +0000
commitbb6320535d6bcef1a5d44cb7429877166c4d5298 (patch)
tree0827c278158213a567ed818ed52ad8082f1e68be /src/runtime/malloc.go
parent57afa76471ccb3fd9e92349825f90b6c354fc9b5 (diff)
downloadgo-bb6320535d6bcef1a5d44cb7429877166c4d5298.tar.xz
runtime: replace STW for enabling write barriers with ragged barrier
Currently, we use a full stop-the-world around enabling write barriers. This is to ensure that all Gs have enabled write barriers before any blackening occurs (either in gcBgMarkWorker() or in gcAssistAlloc()). However, there's no need to bring the whole world to a synchronous stop to ensure this. This change replaces the STW with a ragged barrier that ensures each P has individually observed that write barriers should be enabled before GC performs any blackening. Change-Id: If2f129a6a55bd8bdd4308067af2b739f3fb41955 Reviewed-on: https://go-review.googlesource.com/8207 Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/malloc.go')
-rw-r--r--src/runtime/malloc.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go
index 5896e74e91..91d69b5a9b 100644
--- a/src/runtime/malloc.go
+++ b/src/runtime/malloc.go
@@ -686,7 +686,7 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {
if shouldtriggergc() {
startGC(gcBackgroundMode)
- } else if gcphase == _GCmark {
+ } else if gcBlackenEnabled != 0 {
// Assist garbage collector. We delay this until the
// epilogue so that it doesn't interfere with the
// inner working of malloc such as mcache refills that