Ignore expiration count in kernelCPUClockListener.Notify.

PiperOrigin-RevId: 200590832
Change-Id: I35b817ecccc9414a742dee4815dfc67d0c7d0496
This commit is contained in:
Jamie Liu 2018-06-14 11:34:15 -07:00 committed by Shentubot
parent d71f5ef688
commit 657db692b2
1 changed files with 7 additions and 1 deletions

View File

@ -960,7 +960,13 @@ type kernelCPUClockListener struct {
// Notify implements ktime.TimerListener.Notify.
func (l kernelCPUClockListener) Notify(exp uint64) {
atomic.AddUint64(&l.k.cpuClock, exp)
// Only increment cpuClock by 1 regardless of the number of expirations.
// This approximately compensates for cases where thread throttling or bad
// Go runtime scheduling prevents the cpuClockTicker goroutine, and
// presumably task goroutines as well, from executing for a long period of
// time. It's also necessary to prevent CPU clocks from seeing large
// discontinuous jumps.
atomic.AddUint64(&l.k.cpuClock, 1)
}
// Destroy implements ktime.TimerListener.Destroy.