• Michael Anthony Knyszek's avatar
    runtime: rearrange mheap_.alloc* into allocSpan · a762221b
    Michael Anthony Knyszek authored
    This change combines the functionality of allocSpanLocked, allocManual,
    and alloc_m into a new method called allocSpan. While these methods'
    abstraction boundaries are OK when the heap lock is held throughout,
    they start to break down when we want finer-grained locking in the page
    allocator.
    
    allocSpan does just that, and only locks the heap when it absolutely has
    to. Piggy-backing off of work in previous CLs to make more of span
    initialization lockless, this change makes span initialization entirely
    lockless as part of the reorganization.
    
    Ultimately this change will enable us to add a lockless fast path to
    allocSpan.
    
    Updates #35112.
    
    Change-Id: I99875939d75fb4e958a67ac99e4a7cda44f06864
    Reviewed-on: https://go-review.googlesource.com/c/go/+/196641
    Run-TryBot: Michael Knyszek <mknyszek@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarAustin Clements <austin@google.com>
    a762221b
mheap.go 58 KB