mirror of
https://github.com/golang/go.git
synced 2026-04-02 17:30:01 +09:00
Revert "runtime: fix memclrNoHeapPointersPreemptible"
This reverts CL 756122. Reason: Adding preemptible memclrNoHeapPointers exposes existing unsafe use of notInHeapSlice, causing crashes. Revert the memclr stack until the underlying issue is fixed. For #78254. Change-Id: I8a234d1a6dddf70d9aa5ecda1ac8bb25deb08248 Reviewed-on: https://go-review.googlesource.com/c/go/+/757342 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
committed by
Keith Randall
parent
2de90fd48f
commit
16018b05ae
@@ -2184,27 +2184,22 @@ func reusableSize(size uintptr) bool {
|
||||
// Use this with care; if the data being cleared is tagged to contain
|
||||
// pointers, this allows the GC to run before it is all cleared.
|
||||
func memclrNoHeapPointersChunked(size uintptr, x unsafe.Pointer) {
|
||||
if getg().preempt {
|
||||
// TODO: no need for this, except to test that
|
||||
// the preemption point is ok for small zeroings.
|
||||
// (The pre-CL-756122 allowed preemption in this case,
|
||||
// which is probably why we noticed 78081 at all.)
|
||||
// Remove once we think 78081 is fixed.
|
||||
// may hold locks, e.g., profiling
|
||||
goschedguarded()
|
||||
}
|
||||
v := uintptr(x)
|
||||
// got this from benchmarking. 128k is too small, 512k is too large.
|
||||
const chunkBytes = 256 * 1024
|
||||
for size > chunkBytes {
|
||||
memclrNoHeapPointers(x, chunkBytes)
|
||||
x = add(x, chunkBytes)
|
||||
size -= chunkBytes
|
||||
vsize := v + size
|
||||
for voff := v; voff < vsize; voff = voff + chunkBytes {
|
||||
if getg().preempt {
|
||||
// may hold locks, e.g., profiling
|
||||
goschedguarded()
|
||||
}
|
||||
// clear min(avail, lump) bytes
|
||||
n := vsize - voff
|
||||
if n > chunkBytes {
|
||||
n = chunkBytes
|
||||
}
|
||||
memclrNoHeapPointers(unsafe.Pointer(voff), n)
|
||||
}
|
||||
memclrNoHeapPointers(x, size)
|
||||
}
|
||||
|
||||
// memclrNoHeapPointersPreemptible is the compiler-callable entry point
|
||||
|
||||
Reference in New Issue
Block a user