mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: clean up old mcentral code
This change deletes the old mcentral implementation from the code base and the newMCentralImpl feature flag along with it. Updates #37487. Change-Id: Ibca8f722665f0865051f649ffe699cbdbfdcfcf2 Reviewed-on: https://go-review.googlesource.com/c/go/+/221184 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
parent
260dff3ca3
commit
e6d0bd2b89
8 changed files with 25 additions and 665 deletions
|
|
@ -44,15 +44,6 @@ const (
|
|||
// Must be a multiple of the pageInUse bitmap element size and
|
||||
// must also evenly divid pagesPerArena.
|
||||
pagesPerReclaimerChunk = 512
|
||||
|
||||
// go115NewMCentralImpl is a feature flag for the new mcentral implementation.
|
||||
//
|
||||
// This flag depends on go115NewMarkrootSpans because the new mcentral
|
||||
// implementation requires that markroot spans no longer rely on mgcsweepbufs.
|
||||
// The definition of this flag helps ensure that if there's a problem with
|
||||
// the new markroot spans implementation and it gets turned off, that the new
|
||||
// mcentral implementation also gets turned off so the runtime isn't broken.
|
||||
go115NewMCentralImpl = true
|
||||
)
|
||||
|
||||
// Main malloc heap.
|
||||
|
|
@ -85,19 +76,6 @@ type mheap struct {
|
|||
// access (since that may free the backing store).
|
||||
allspans []*mspan // all spans out there
|
||||
|
||||
// sweepSpans contains two mspan stacks: one of swept in-use
|
||||
// spans, and one of unswept in-use spans. These two trade
|
||||
// roles on each GC cycle. Since the sweepgen increases by 2
|
||||
// on each cycle, this means the swept spans are in
|
||||
// sweepSpans[sweepgen/2%2] and the unswept spans are in
|
||||
// sweepSpans[1-sweepgen/2%2]. Sweeping pops spans from the
|
||||
// unswept stack and pushes spans that are still in-use on the
|
||||
// swept stack. Likewise, allocating an in-use span pushes it
|
||||
// on the swept stack.
|
||||
//
|
||||
// For !go115NewMCentralImpl.
|
||||
sweepSpans [2]gcSweepBuf
|
||||
|
||||
_ uint32 // align uint64 fields on 32-bit for atomics
|
||||
|
||||
// Proportional sweep
|
||||
|
|
@ -220,7 +198,7 @@ type mheap struct {
|
|||
base, end uintptr
|
||||
}
|
||||
|
||||
// _ uint32 // ensure 64-bit alignment of central
|
||||
_ uint32 // ensure 64-bit alignment of central
|
||||
|
||||
// central free lists for small size classes.
|
||||
// the padding makes sure that the mcentrals are
|
||||
|
|
@ -719,8 +697,6 @@ func pageIndexOf(p uintptr) (arena *heapArena, pageIdx uintptr, pageMask uint8)
|
|||
// Initialize the heap.
|
||||
func (h *mheap) init() {
|
||||
lockInit(&h.lock, lockRankMheap)
|
||||
lockInit(&h.sweepSpans[0].spineLock, lockRankSpine)
|
||||
lockInit(&h.sweepSpans[1].spineLock, lockRankSpine)
|
||||
lockInit(&h.speciallock, lockRankMheapSpecial)
|
||||
|
||||
h.spanalloc.init(unsafe.Sizeof(mspan{}), recordspan, unsafe.Pointer(h), &memstats.mspan_sys)
|
||||
|
|
@ -1294,16 +1270,6 @@ HaveSpan:
|
|||
h.setSpans(s.base(), npages, s)
|
||||
|
||||
if !manual {
|
||||
if !go115NewMCentralImpl {
|
||||
// Add to swept in-use list.
|
||||
//
|
||||
// This publishes the span to root marking.
|
||||
//
|
||||
// h.sweepgen is guaranteed to only change during STW,
|
||||
// and preemption is disabled in the page allocator.
|
||||
h.sweepSpans[h.sweepgen/2%2].push(s)
|
||||
}
|
||||
|
||||
// Mark in-use span in arena page bitmap.
|
||||
//
|
||||
// This publishes the span to the page sweeper, so
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue