diff options
| author | “Muhammad <hamza3256@live.co.uk> | 2026-03-01 23:53:03 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-04 11:13:38 -0800 |
| commit | 50126a8e44f76134349edf5ba3cc94efabc61c80 (patch) | |
| tree | 1b4110fadab2962c3250ce844a0e2e8f6898e003 /src/net/http | |
| parent | 7aeb2f7e285006ad68789581dedf2b35ba444dbf (diff) | |
| download | go-50126a8e44f76134349edf5ba3cc94efabc61c80.tar.xz | |
runtime, cmd/compile: use preemptible memclr for large pointer-free clears
Large memory clearing operations (via clear() or large slice allocation)
currently use non-preemptible assembly loops. This blocks the Garbage
Collector from performing a Stop The World (STW) event, leading to
significant tail latency or even indefinite hangs in tight loops.
This change introduces memclrNoHeapPointersPreemptible, which chunks
clears into 256KB blocks with preemption checks. The compiler's walk
phase is updated to emit this call for large pointer-free clears.
To prevent regressions, SSA rewrite rules are added to ensure that
constant-size clears (which are common and small) continue to be
inlined into OpZero assembly.
Benchmarks on darwin/arm64:
- STW with 50MB clear: Improved from 'Hung' to ~500µs max pause.
- Small clears (5-64B): No measurable regression.
- Large clears (1M-64M): No measurable regression.
Fixes #69327
Change-Id: Ide14d6bcdca1f60d6ac95443acb57da9a8822538
Reviewed-on: https://go-review.googlesource.com/c/go/+/750480
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/net/http')
0 files changed, 0 insertions, 0 deletions
