diff options
| author | Austin Clements <austin@google.com> | 2015-05-15 16:03:27 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2015-05-18 14:55:18 +0000 |
| commit | 5f7060afd2dea927ac64804c7e4639f6635c3bb7 (patch) | |
| tree | f78ef4d86f8ec1a5ba9f10ab40ffd131802cc9d8 /src/runtime | |
| parent | e544bee1ddf4a2869221b68ef8cec6c97b6d827b (diff) | |
| download | go-5f7060afd2dea927ac64804c7e4639f6635c3bb7.tar.xz | |
runtime: don't start GC if preemptoff is set
In order to avoid deadlocks, startGC avoids kicking off GC if locks
are held by the calling M. However, it currently fails to check
preemptoff, which is the other way to disable preemption.
Fix this by adding a check for preemptoff.
Change-Id: Ie1083166e5ba4af5c9d6c5a42efdfaaef41ca997
Reviewed-on: https://go-review.googlesource.com/10153
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/mgc.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index d33fbf11de..848b46804c 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -703,7 +703,7 @@ func startGC(mode int) { // trying to run gc while holding a lock. The next mallocgc without a lock // will do the gc instead. mp := acquirem() - if gp := getg(); gp == mp.g0 || mp.locks > 1 || !memstats.enablegc || panicking != 0 || gcpercent < 0 { + if gp := getg(); gp == mp.g0 || mp.locks > 1 || mp.preemptoff != "" || !memstats.enablegc || panicking != 0 || gcpercent < 0 { releasem(mp) return } |
