commit | b58067013eaa2f2bf0dc24f4d848e10bb758b6bd | [log] [tgz] |
---|---|---|
author | Michael Anthony Knyszek <mknyszek@google.com> | Fri May 20 16:30:11 2022 +0000 |
committer | Michael Knyszek <mknyszek@google.com> | Fri May 20 21:54:20 2022 +0000 |
tree | 6870a458dedd52c3126c5047dec0bbd11fbb5fcd | |
parent | 7ec6ef432a85a390365f2daed788f0d14c830c73 [diff] |
runtime: allocate physical-page-aligned memory differently Currently, physical-page-aligned allocations for stacks (where the physical page size is greater than the runtime page size) first overallocates some memory, then frees the unaligned portions back to the heap. However, because allocating via h.pages.alloc causes scavenged bits to get cleared, we need to account for that memory correctly in heapFree and heapReleased. Currently that is not the case, leading to throws at runtime. Trying to get that accounting right is complicated, because information about exactly which pages were scavenged needs to get plumbed up. Instead, find the oversized region first, and then only allocate the aligned part. This avoids any accounting issues. However, this does come with some performance cost, because we don't update searchAddr (which is safe, it just means the next allocation potentially must look harder) and we skip the fast path that h.pages.alloc has for simplicity. Fixes #52682. Change-Id: Iefa68317584d73b187634979d730eb30db770bb6 Reviewed-on: https://go-review.googlesource.com/c/go/+/407502 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Official binary distributions are available at https://go.dev/dl/.
After downloading a binary release, visit https://go.dev/doc/install for installation instructions.
If a binary distribution is not available for your combination of operating system and architecture, visit https://go.dev/doc/install/source for source installation instructions.
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines at https://go.dev/doc/contribute.
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://go.dev/wiki/Questions for a list of places to ask questions about the Go language.