Skip to content

Commit

Permalink
runtime: remove GC start up/shutdown workaround in mallocgc
Browse files Browse the repository at this point in the history
Currently mallocgc detects if the GC is in a state where it can't
assist, but also can't allocate uncontrolled and yields to help out
the GC. This was a workaround for periods when we were trying to
schedule the GC coordinator. It is no longer necessary because there
is no GC coordinator and malloc can always assist with any GC
transitions that are necessary.

Updates golang#11970.

Change-Id: I4f7beb7013e85e50ae99a3a8b0bb708ba49cbcd4
Reviewed-on: https://go-review.googlesource.com/16392
Reviewed-by: Rick Hudson <[email protected]>
Run-TryBot: Austin Clements <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
aclements committed Nov 5, 2015
1 parent c99d7f7 commit bbf2da0
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/runtime/malloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -736,17 +736,6 @@ func mallocgc(size uintptr, typ *_type, flags uint32) unsafe.Pointer {

if shouldhelpgc && gcShouldStart(false) {
gcStart(gcBackgroundMode, false)
} else if shouldhelpgc && bggc.working != 0 && gcBlackenEnabled == 0 {
// The GC shutting down, so we can't
// assist, but we also can't allocate unabated. Slow
// down this G's allocation and help the GC stay
// scheduled by yielding.
//
// TODO: This is unused. Remove.
gp := getg()
if gp != gp.m.g0 && gp.m.locks == 0 && gp.m.preemptoff == "" {
Gosched()
}
}

return x
Expand Down

0 comments on commit bbf2da0

Please sign in to comment.