Skip to content

Commit 9db2ccc

Browse files
ayushr2gvisor-bot
authored andcommitted
systrap: preserve latency medians across histogram reset
sentryOnStubOn records the current stub- and sentry-bound latency medians, then resets both histograms before evaluating the two fast paths. The stub check correctly uses the saved values. The sentry check samples the now-empty histograms again, so it always receives zero and cannot account for the period that just ended. Use the saved period medians for the sentry check too. This matches the other state transitions and ensures both decisions are based on the same completed measurement period. Fixes: cffce1a ("systrap: Revise slow-path enablement.") Tested with: make test TARGETS='//pkg/sentry/platform/systrap:systrap_test' FUTURE_COPYBARA_INTEGRATE_REVIEW=#14426 from ayushr2:codex/fix-systrap-fastpath-median 6172a4b PiperOrigin-RevId: 971361249
1 parent 907c32d commit 9db2ccc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/sentry/platform/systrap/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ func sentryOnStubOn(s *fastPathState) {
656656
if s.disableStubFP() {
657657
s.curState = sentryOnStubOff
658658
}
659-
} else if s.shouldDisableSentryFP(latencies.stubBound.getMedian(), latencies.sentryBound.getMedian()) {
659+
} else if s.shouldDisableSentryFP(periodStubBoundMedian, periodSentryBoundMedian) {
660660
if s.disableSentryFP() {
661661
s.curState = sentryOffStubOn
662662
}

0 commit comments

Comments
 (0)