diff options
author | Michael Pratt <mpratt@google.com> | 2019-10-01 12:13:09 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-10-01 12:21:01 -0700 |
commit | dd69b49ed1103bab82a6b2ac95221b89b46f3376 (patch) | |
tree | 35671dd04b4672b892f1c36d53d51ed6a81c8a1a /pkg/refs/refcounter_test.go | |
parent | 90e908f4198d718236758625c54af89201c8c1e7 (diff) |
Disable cpuClockTicker when app is idle
Kernel.cpuClockTicker increments kernel.cpuClock, which tasks use as a clock to
track their CPU usage. This improves latency in the syscall path by avoid
expensive monotonic clock calls on every syscall entry/exit.
However, this timer fires every 10ms. Thus, when all tasks are idle (i.e.,
blocked or stopped), this forces a sentry wakeup every 10ms, when we may
otherwise be able to sleep until the next app-relevant event. These wakeups
cause the sentry to utilize approximately 2% CPU when the application is
otherwise idle.
Updates to clock are not strictly necessary when the app is idle, as there are
no readers of cpuClock. This commit reduces idle CPU by disabling the timer
when tasks are completely idle, and computing its effects at the next wakeup.
Rather than disabling the timer as soon as the app goes idle, we wait until the
next tick, which provides a window for short sleeps to sleep and wakeup without
doing the (relatively) expensive work of disabling and enabling the timer.
PiperOrigin-RevId: 272265822
Diffstat (limited to 'pkg/refs/refcounter_test.go')
0 files changed, 0 insertions, 0 deletions