• Michael Anthony Knyszek's avatar
    runtime: sysUsed spans after trimming · db82a1bc
    Michael Anthony Knyszek authored
    Currently, we mark a whole span as sysUsed before trimming, but this
    unnecessarily tells the OS that the trimmed section from the span is
    used when it may have been scavenged, if s was scavenged. Overall,
    this just makes invocations of sysUsed a little more fine-grained.
    
    It does come with the caveat that now heap_released needs to be managed
    a little more carefully in allocSpanLocked. In this case, we choose to
    (like before this change) negate any effect the span has on
    heap_released before trimming, then add it back if the trimmed part is
    scavengable.
    
    For #14045.
    
    Change-Id: Ifa384d989611398bfad3ca39d3bb595a5962a3ea
    Reviewed-on: https://go-review.googlesource.com/c/140198
    Run-TryBot: Michael Knyszek <mknyszek@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarAustin Clements <austin@google.com>
    db82a1bc
mheap.go 51.4 KB