]> Cypherpunks repositories - gostls13.git/commit
runtime: optimistically CAS atomicstatus directly in enter/exitsyscall
authorMichael Anthony Knyszek <mknyszek@google.com>
Thu, 2 Oct 2025 17:16:49 +0000 (17:16 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 30 Oct 2025 19:55:45 +0000 (12:55 -0700)
commit8683bb846dfc1460c476cfed1696aad8e681926f
tree74581837725db6c60ca5ad233b81caed340350cc
parent5b8e85034028906ab0a243399e18fd8b72fe2f76
runtime: optimistically CAS atomicstatus directly in enter/exitsyscall

This change steals the performance trick from the coro implementation to
try to do the CAS directly first before calling into casgstatus, a much
more heavyweight function. We have to be careful about synctest
bubbling, but overall it's a good bit faster, and easy low-hanging
fruit.

goos: linux
goarch: amd64
pkg: internal/runtime/cgobench
cpu: AMD EPYC 7B13
           │ after-2-2.out │            after-3.out             │
           │    sec/op     │   sec/op     vs base               │
CgoCall-64     34.62n ± 1%   30.55n ± 1%  -11.76% (p=0.002 n=6)

Change-Id: Ic38620233b55f58b8a07510666aa18648373e2e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/708596
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/proc.go