Skip to content

Commit 8fa789b

Browse files
committed
runtime: eliminate mheap.busy* lists
The old whole-page reclaimer was the only thing that used the busy span lists. Remove them so nothing uses them any more. Change-Id: I4007dd2be08b9ef41bfdb0c387215c73c392cc4c Reviewed-on: https://go-review.googlesource.com/c/138960 Run-TryBot: Austin Clements <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Rick Hudson <[email protected]> Reviewed-by: Michael Knyszek <[email protected]>
1 parent 6bd85f7 commit 8fa789b

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/runtime/mheap.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ const minPhysPageSize = 4096
3030
//go:notinheap
3131
type mheap struct {
3232
lock mutex
33-
free mTreap // free and non-scavenged spans
34-
scav mTreap // free and scavenged spans
35-
busy mSpanList // busy list of spans
36-
sweepgen uint32 // sweep generation, see comment in mspan
37-
sweepdone uint32 // all spans are swept
38-
sweepers uint32 // number of active sweepone calls
33+
free mTreap // free and non-scavenged spans
34+
scav mTreap // free and scavenged spans
35+
sweepgen uint32 // sweep generation, see comment in mspan
36+
sweepdone uint32 // all spans are swept
37+
sweepers uint32 // number of active sweepone calls
3938

4039
// allspans is a slice of all mspans ever created. Each mspan
4140
// appears exactly once.
@@ -676,7 +675,7 @@ func (h *mheap) init() {
676675
h.spanalloc.zero = false
677676

678677
// h->mapcache needs no init
679-
h.busy.init()
678+
680679
for i := range h.central {
681680
h.central[i].mcentral.init(spanClass(i))
682681
}
@@ -893,8 +892,6 @@ func (h *mheap) alloc_m(npage uintptr, spanclass spanClass, large bool) *mspan {
893892
mheap_.largealloc += uint64(s.elemsize)
894893
mheap_.nlargealloc++
895894
atomic.Xadd64(&memstats.heap_live, int64(npage<<_PageShift))
896-
// Swept spans are at the end of lists.
897-
h.busy.insertBack(s)
898895
}
899896
}
900897
// heap_scan and heap_live were updated.
@@ -1199,9 +1196,6 @@ func (h *mheap) freeSpanLocked(s *mspan, acctinuse, acctidle bool, unusedsince i
11991196
memstats.heap_idle += uint64(s.npages << _PageShift)
12001197
}
12011198
s.state = mSpanFree
1202-
if s.inList() {
1203-
h.busy.remove(s)
1204-
}
12051199

12061200
// Stamp newly unused spans. The scavenger will use that
12071201
// info to potentially give back some pages to the OS.

0 commit comments

Comments
 (0)