]> Cypherpunks repositories - gostls13.git/commit
runtime: break up large calls to memclrNoHeapPointers to allow preemption
authorDavid Chase <drchase@google.com>
Wed, 18 Nov 2020 00:54:31 +0000 (19:54 -0500)
committerDavid Chase <drchase@google.com>
Fri, 30 Apr 2021 19:41:02 +0000 (19:41 +0000)
commit0bbfc5c31eb4cb77f12e10c73d5462377e66b06c
tree7641ae1ee24c4e0c425ef8e023844506398de440
parent41afd3af42bd8028a1740c30a2b745105b4063d2
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>
src/runtime/malloc.go
src/runtime/mcache.go
src/runtime/mcentral.go
src/runtime/mheap.go