]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use gList for work.sweepWaiters
authorAustin Clements <austin@google.com>
Fri, 10 Aug 2018 14:28:44 +0000 (10:28 -0400)
committerAustin Clements <austin@google.com>
Mon, 20 Aug 2018 18:19:27 +0000 (18:19 +0000)
Change-Id: Ibae474a5c9a3528a042ddf19ddb4a88913a87606
Reviewed-on: https://go-review.googlesource.com/129399
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/mgc.go

index 7d4ba9f9cd70b72b467c8bd4a8f1ce28aabd6bcc..2d67c4d8c44856fb9d37b29eb96774bc8554c2ac 100644 (file)
@@ -1031,7 +1031,7 @@ var work struct {
        // we transition from mark termination to sweep.
        sweepWaiters struct {
                lock mutex
-               head guintptr
+               list gList
        }
 
        // cycles is the number of completed GC cycles, where a GC
@@ -1146,9 +1146,7 @@ func gcWaitOnMark(n uint32) {
 
                // Wait until sweep termination, mark, and mark
                // termination of cycle N complete.
-               gp := getg()
-               gp.schedlink = work.sweepWaiters.head
-               work.sweepWaiters.head.set(gp)
+               work.sweepWaiters.list.push(getg())
                goparkunlock(&work.sweepWaiters.lock, waitReasonWaitForGCCycle, traceEvGoBlock, 1)
        }
 }
@@ -1632,8 +1630,8 @@ func gcMarkTermination(nextTriggerRatio float64) {
        // Bump GC cycle count and wake goroutines waiting on sweep.
        lock(&work.sweepWaiters.lock)
        memstats.numgc++
-       injectglist(work.sweepWaiters.head.ptr())
-       work.sweepWaiters.head = 0
+       injectglist(work.sweepWaiters.list.head.ptr())
+       work.sweepWaiters.list = gList{}
        unlock(&work.sweepWaiters.lock)
 
        // Finish the current heap profiling cycle and start a new