sched: Fix clock_gettime(CLOCK_[PROCESS/THREAD]_CPUTIME_ID) monotonicity
authorMike Galbraith <umgwanakikbuti@gmail.com>
Tue, 24 Jun 2014 05:49:40 +0000 (07:49 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 5 Jul 2014 09:17:30 +0000 (11:17 +0200)
commit4036ac1567834222fc763ab18e3e17df93b4eaaf
treee5063b46415b169fbfa3895d5faa4008f003f402
parentc06f04c70489b9deea3212af8375e2f0c2f0b184
sched: Fix clock_gettime(CLOCK_[PROCESS/THREAD]_CPUTIME_ID) monotonicity

If a task has been dequeued, it has been accounted.  Do not project
cycles that may or may not ever be accounted to a dequeued task, as
that may make clock_gettime() both inaccurate and non-monotonic.

Protect update_rq_clock() from slight TSC skew while at it.

Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: kosaki.motohiro@jp.fujitsu.com
Cc: pjt@google.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1403588980.29711.11.camel@marge.simpson.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c