aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mpagealloc.go
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2024-03-08 10:12:41 +0000
committerGopher Robot <gobot@golang.org>2024-03-08 16:28:44 +0000
commitc8c46e746b778c39727c588adf79aff34ab6f151 (patch)
treef31e5cbc08220e791e9137e57e1e70016cb89f41 /src/runtime/mpagealloc.go
parent69583738eb73ef928a07a1e215b719823fd27aa9 (diff)
downloadgo-c8c46e746b778c39727c588adf79aff34ab6f151.tar.xz
runtime: use built-in clear to simplify code
Change-Id: Icb6d9ca996b4119d8636d9f7f6a56e510d74d059 GitHub-Last-Rev: 08178e8ff798f4a51860573788c9347a0fb6bc40 GitHub-Pull-Request: golang/go#66188 Reviewed-on: https://go-review.googlesource.com/c/go/+/569979 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: qiulaidongfeng <2645477756@qq.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/mpagealloc.go')
-rw-r--r--src/runtime/mpagealloc.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/runtime/mpagealloc.go b/src/runtime/mpagealloc.go
index d533f84180..7c117b0a9b 100644
--- a/src/runtime/mpagealloc.go
+++ b/src/runtime/mpagealloc.go
@@ -511,10 +511,7 @@ func (p *pageAlloc) update(base, npages uintptr, contig, alloc bool) {
// either totally allocated or freed.
whole := p.summary[len(p.summary)-1][sc+1 : ec]
if alloc {
- // Should optimize into a memclr.
- for i := range whole {
- whole[i] = 0
- }
+ clear(whole)
} else {
for i := range whole {
whole[i] = freeChunkSum