Files
gvisor/pkg/sync/runtime_amd64.go
Michael Pratt a8d6cc4072 Move nmspinning address lookup to dynamic facts render
This removes the need to check the offset every release.

I've also removed the negative build tag from runtime_amd64.go, which less
obviously correct. In theory, we should check that this package's use of
nmspinning is still valid in each release, but there is no way to automate that
and I don't realistically seeing checking happening beyond verifying tests
work. Additionally, the existing use is already suspect. :)

The good news is the misuse is likely to cause scheduling issues, not memory
corruption.

PiperOrigin-RevId: 505114683
2023-01-27 07:43:26 -08:00

31 lines
579 B
Go

// Copyright 2020 The gVisor Authors.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build amd64
package sync
import (
"sync/atomic"
)
const supportsWakeSuppression = true
// addrOfSpinning returns the address of runtime.sched.nmspinning.
func addrOfSpinning() *int32
// nmspinning caches addrOfSpinning.
var nmspinning = addrOfSpinning()
//go:nosplit
func preGoReadyWakeSuppression() {
atomic.AddInt32(nmspinning, 1)
}
//go:nosplit
func postGoReadyWakeSuppression() {
atomic.AddInt32(nmspinning, -1)
}