From 5f5f4ccdb385fa73de5729cfe8c0336b44a88f4c Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 20 Mar 2026 17:50:07 -0400 Subject: Revert "runtime, cmd/compile: use preemptible memclr for large pointer-free clears" This reverts CL 750480. Reason: Adding preemptible memclrNoHeapPointers exposes existing unsafe use of notInHeapSlice, causing crashes. Revert the memclr stack until the underlying issue is fixed. We keep the test added in CL 755942, which is useful regardless. For #78254. Change-Id: I8be3f9a20292b7f294e98e74e5a86c6a204406ae Reviewed-on: https://go-review.googlesource.com/c/go/+/757343 Reviewed-by: Keith Randall LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall --- src/runtime/malloc.go | 9 --------- src/runtime/memmove_test.go | 25 ------------------------- 2 files changed, 34 deletions(-) (limited to 'src/runtime') diff --git a/src/runtime/malloc.go b/src/runtime/malloc.go index 2144ea602a..c08bc7574b 100644 --- a/src/runtime/malloc.go +++ b/src/runtime/malloc.go @@ -2202,15 +2202,6 @@ func memclrNoHeapPointersChunked(size uintptr, x unsafe.Pointer) { } } -// memclrNoHeapPointersPreemptible is the compiler-callable entry point -// for clearing large buffers with preemption support. It has the same -// signature as memclrNoHeapPointers so the compiler can emit calls to it -// directly. It delegates to memclrNoHeapPointersChunked which splits the -// work into 256KB chunks with preemption checks between them. -func memclrNoHeapPointersPreemptible(ptr unsafe.Pointer, n uintptr) { - memclrNoHeapPointersChunked(n, ptr) -} - // implementation of new builtin // compiler (both frontend and SSA backend) knows the signature // of this function. diff --git a/src/runtime/memmove_test.go b/src/runtime/memmove_test.go index 292dd0f686..6065a84553 100644 --- a/src/runtime/memmove_test.go +++ b/src/runtime/memmove_test.go @@ -1374,28 +1374,3 @@ func BenchmarkMemmoveKnownSize1024(b *testing.B) { memclrSink = p.x[:] } - -func BenchmarkSTWLatency(b *testing.B) { - const bufSize = 50 << 20 // 50 MiB - - buf := make([]byte, bufSize) - var stop atomic.Bool - go func() { - for !stop.Load() { - clear(buf) - } - }() - - var maxPause int64 - for i := 0; i < b.N; i++ { - start := Nanotime() - GC() - elapsed := Nanotime() - start - if elapsed > maxPause { - maxPause = elapsed - } - } - stop.Store(true) - - b.ReportMetric(float64(maxPause)/1e3, "max-pause-µs") -} -- cgit v1.3-5-g9baa