mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
a8d6cc4072
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
31 lines
579 B
Go
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)
|
|
}
|