1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:47:58 -07:00

runtime: remove unused casgcopystack function

Change-Id: I349b24ba5259d7abb0ae37065f704517aa4decda
Reviewed-on: https://go-review.googlesource.com/c/go/+/630155
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Damien Neil 2024-11-20 08:25:20 -08:00 committed by Gopher Robot
parent 1d28fa8c43
commit 2c02b4a252

View File

@ -1317,28 +1317,6 @@ func casGToWaitingForGC(gp *g, old uint32, reason waitReason) {
casGToWaiting(gp, old, reason)
}
// casgstatus(gp, oldstatus, Gcopystack), assuming oldstatus is Gwaiting or Grunnable.
// Returns old status. Cannot call casgstatus directly, because we are racing with an
// async wakeup that might come in from netpoll. If we see Gwaiting from the readgstatus,
// it might have become Grunnable by the time we get to the cas. If we called casgstatus,
// it would loop waiting for the status to go back to Gwaiting, which it never will.
//
//go:nosplit
func casgcopystack(gp *g) uint32 {
for {
oldstatus := readgstatus(gp) &^ _Gscan
if oldstatus != _Gwaiting && oldstatus != _Grunnable {
throw("copystack: bad status, not Gwaiting or Grunnable")
}
if gp.atomicstatus.CompareAndSwap(oldstatus, _Gcopystack) {
if sg := gp.syncGroup; sg != nil {
sg.changegstatus(gp, oldstatus, _Gcopystack)
}
return oldstatus
}
}
}
// casGToPreemptScan transitions gp from _Grunning to _Gscan|_Gpreempted.
//
// TODO(austin): This is the only status operation that both changes