]> Cypherpunks repositories - gostls13.git/commit
runtime: rearrange mheap_.alloc* into allocSpan
authorMichael Anthony Knyszek <mknyszek@google.com>
Wed, 18 Sep 2019 15:44:11 +0000 (15:44 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 8 Nov 2019 17:01:18 +0000 (17:01 +0000)
commita762221bea7c02a17cffc6937d8af33a027a32e5
tree8ed1ad5dfad0dd428571ade56dff15fbf1c179f4
parenta5a6f61043dcd8fe9c9ccd4b9ddef0c40fe1105f
runtime: rearrange mheap_.alloc* into allocSpan

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: Austin Clements <austin@google.com>
src/runtime/mheap.go