systrap: Rename fpState to fastpath.

FPState is already used in ThreadContexts. It's better to rename this
global to something more descriptive.

PiperOrigin-RevId: 597920631
This commit is contained in:
Konstantin Bogomolov
2024-01-12 12:36:31 -08:00
committed by gVisor bot
parent 39afbf09cd
commit 49f7ee9e92
4 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -100,7 +100,7 @@ func (q *contextQueue) queuedContexts() uint32 {
func (q *contextQueue) add(ctx *sharedContext) {
ctx.startWaitingTS = cputicks()
if fpState.stubFastPath() {
if fastpath.stubFastPath() {
q.enableFastPath()
} else {
q.disableFastPath()
@@ -119,7 +119,7 @@ func (q *contextQueue) add(ctx *sharedContext) {
atomic.StoreUint64(&q.ringbuffer[next], v)
if atomic.SwapUint32(&q.usedFastPath, 0) != 0 {
fpState.usedStubFastPath.Store(true)
fastpath.usedStubFastPath.Store(true)
}
}
+4 -4
View File
@@ -241,7 +241,7 @@ type fastPathState struct {
}
var (
fpState = fastPathState{
fastpath = fastPathState{
stubFPBackoff: fastPathBackoffMin,
sentryFPBackoff: fastPathBackoffMin,
curState: sentryOffStubOff,
@@ -262,10 +262,10 @@ func controlFastPath() {
for {
time.Sleep(recordingPeriod)
fpState.curState(&fpState)
fastpath.curState(&fastpath)
// Reset FP trackers.
fpState.usedStubFastPath.Store(false)
fpState.usedSentryFastPath.Store(false)
fastpath.usedStubFastPath.Store(false)
fastpath.usedSentryFastPath.Store(false)
}
}
@@ -317,7 +317,7 @@ func (q *fastPathDispatcher) loop(target *sharedContext) {
break
}
slowPath = !fpState.sentryFastPath() || slowPath
slowPath = !fastpath.sentryFastPath() || slowPath
processed = 0
now := cputicks()
for ctx = q.list.Front(); ctx != nil; ctx = next {
@@ -349,7 +349,7 @@ func (q *fastPathDispatcher) loop(target *sharedContext) {
startedSpinning = now
firstTimeout = false
} else {
fpState.usedSentryFastPath.Store(true)
fastpath.usedSentryFastPath.Store(true)
}
// If dispatcher has been spinning for too long, send this
// dispatcher to sleep.
+2 -2
View File
@@ -701,7 +701,7 @@ func (s *subprocess) incAwakeContexts() {
if nr > uint32(maxSysmsgThreads) {
return
}
fpState.nrMaxAwakeStubThreads.Add(1)
fastpath.nrMaxAwakeStubThreads.Add(1)
}
func (s *subprocess) decAwakeContexts() {
@@ -709,7 +709,7 @@ func (s *subprocess) decAwakeContexts() {
if nr >= uint32(maxSysmsgThreads) {
return
}
fpState.nrMaxAwakeStubThreads.Add(^uint32(0))
fastpath.nrMaxAwakeStubThreads.Add(^uint32(0))
}
// switchToApp is called from the main SwitchToApp entrypoint.