diff options
author | David Chase <drchase@google.com> | 2020-11-17 19:54:31 -0500 |
---|---|---|
committer | David Chase <drchase@google.com> | 2021-04-30 19:41:02 +0000 |
commit | 0bbfc5c31eb4cb77f12e10c73d5462377e66b06c (patch) | |
tree | 7641ae1ee24c4e0c425ef8e023844506398de440 /src/runtime/mcentral.go | |
parent | 41afd3af42bd8028a1740c30a2b745105b4063d2 (diff) | |
download | go-0bbfc5c31eb4cb77f12e10c73d5462377e66b06c.tar.gz go-0bbfc5c31eb4cb77f12e10c73d5462377e66b06c.zip |
runtime: break up large calls to memclrNoHeapPointers to allow preemption
If something "huge" is allocated, and the zeroing is trivial (no pointers
involved) then zero it by chunks in a loop so that preemption can occur,
not all in a single non-preemptible call.
Benchmarking suggests that 256K is the best chunk size.
Updates #42642.
Change-Id: I94015e467eaa098c59870e479d6d83bc88efbfb4
Reviewed-on: https://go-review.googlesource.com/c/go/+/270943
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/mcentral.go')
-rw-r--r-- | src/runtime/mcentral.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/mcentral.go b/src/runtime/mcentral.go index 4eeac3be88..6013c94c69 100644 --- a/src/runtime/mcentral.go +++ b/src/runtime/mcentral.go @@ -238,7 +238,7 @@ func (c *mcentral) grow() *mspan { npages := uintptr(class_to_allocnpages[c.spanclass.sizeclass()]) size := uintptr(class_to_size[c.spanclass.sizeclass()]) - s := mheap_.alloc(npages, c.spanclass, true) + s, _ := mheap_.alloc(npages, c.spanclass, true) if s == nil { return nil } |