]> Cypherpunks repositories - gostls13.git/commit
runtime: fix a few GC-related bugs
authorRuss Cox <rsc@golang.org>
Tue, 13 Jan 2015 20:55:16 +0000 (15:55 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 15:05:33 +0000 (15:05 +0000)
commitaae0f074c0b42a337b61672ee6b0fd53d4c9d3f3
tree697fec8a97dd8bea873b342bc897a1d52aafd991
parentb8d67596f67ea13525e752a02f45c9d9f346472d
runtime: fix a few GC-related bugs

1) Move non-preemption check even earlier in newstack.
This avoids a few priority inversion problems.

2) Always use atomic operations to update bitmap for 1-word objects.
This avoids lost mark bits during concurrent GC.

3) Stop using work.nproc == 1 as a signal for being single-threaded.
The concurrent GC runs with work.nproc == 1 but other procs are
running mutator code.

The use of work.nproc == 1 in getfull *is* safe, but remove it anyway,
since it is saving only a single atomic operation per GC round.

Fixes #9225.

Change-Id: I24134f100ad592ea8cb59efb6a54f5a1311093dc
Reviewed-on: https://go-review.googlesource.com/2745
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/malloc.go
src/runtime/mgc.go
src/runtime/stack1.go