diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-11-17 02:58:35 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-11-17 02:58:35 +0000 |
commit | f7cb70e6045725c88bd0358af081a96c71764e2c (patch) | |
tree | a8a6a4c3704c359d670fbf586ffab7c8bede0d47 /pkg/sentry/kernel/task_sched.go | |
parent | 242d55192f268b96957174c1058d8b200508647a (diff) | |
parent | 267560d159b299a17f626029d7091ab923afeef6 (diff) |
Merge release-20201109.0-53-g267560d15 (automated)
Diffstat (limited to 'pkg/sentry/kernel/task_sched.go')
-rw-r--r-- | pkg/sentry/kernel/task_sched.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_sched.go b/pkg/sentry/kernel/task_sched.go index 52c55d13d..9ba5f8d78 100644 --- a/pkg/sentry/kernel/task_sched.go +++ b/pkg/sentry/kernel/task_sched.go @@ -157,6 +157,18 @@ func (t *Task) accountTaskGoroutineLeave(state TaskGoroutineState) { t.goschedSeq.EndWrite() } +// Preconditions: The caller must be running on the task goroutine. +func (t *Task) accountTaskGoroutineRunning() { + now := t.k.CPUClockNow() + if t.gosched.State != TaskGoroutineRunningSys { + panic(fmt.Sprintf("Task goroutine in state %v (expected %v)", t.gosched.State, TaskGoroutineRunningSys)) + } + t.goschedSeq.BeginWrite() + t.gosched.SysTicks += now - t.gosched.Timestamp + t.gosched.Timestamp = now + t.goschedSeq.EndWrite() +} + // TaskGoroutineSchedInfo returns a copy of t's task goroutine scheduling info. // Most clients should use t.CPUStats() instead. func (t *Task) TaskGoroutineSchedInfo() TaskGoroutineSchedInfo { |