cputime: Safely read cputime of full dynticks CPUs
authorFrederic Weisbecker <fweisbec@gmail.com>
Sun, 16 Dec 2012 19:00:34 +0000 (20:00 +0100)
committerFrederic Weisbecker <fweisbec@gmail.com>
Sun, 27 Jan 2013 19:35:47 +0000 (20:35 +0100)
commit6a61671bb2f3a1bd12cd17b8fca811a624782632
tree0afc2915fb7e517472710a49a524510322dd5baa
parentc11f11fcbdb5be790c565aed46411486a7586afc
cputime: Safely read cputime of full dynticks CPUs

While remotely reading the cputime of a task running in a
full dynticks CPU, the values stored in utime/stime fields
of struct task_struct may be stale. Its values may be those
of the last kernel <-> user transition time snapshot and
we need to add the tickless time spent since this snapshot.

To fix this, flush the cputime of the dynticks CPUs on
kernel <-> user transition and record the time / context
where we did this. Then on top of this snapshot and the current
time, perform the fixup on the reader side from task_times()
accessors.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
[fixed kvm module related build errors]
Signed-off-by: Sedat Dilek <sedat.dilek@gmail.com>
arch/s390/kernel/vtime.c
include/linux/hardirq.h
include/linux/init_task.h
include/linux/kvm_host.h
include/linux/sched.h
include/linux/vtime.h
kernel/context_tracking.c
kernel/fork.c
kernel/sched/core.c
kernel/sched/cputime.c
kernel/softirq.c