sched: fix process time monotonicity
authorBalbir Singh <balbir@linux.vnet.ibm.com>
Fri, 5 Sep 2008 16:12:23 +0000 (18:12 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 5 Sep 2008 16:14:35 +0000 (18:14 +0200)
commit49048622eae698e5c4ae61f7e71200f265ccc529
treee568595fe5329e1293eafc3a3cc833dfe89ffbf2
parent56c7426b3951e4f35a71d695f1c982989399d6fd
sched: fix process time monotonicity

Spencer reported a problem where utime and stime were going negative despite
the fixes in commit b27f03d4bdc145a09fb7b0c0e004b29f1ee555fa. The suspected
reason for the problem is that signal_struct maintains it's own utime and
stime (of exited tasks), these are not updated using the new task_utime()
routine, hence sig->utime can go backwards and cause the same problem
to occur (sig->utime, adds tsk->utime and not task_utime()). This patch
fixes the problem

TODO: using max(task->prev_utime, derived utime) works for now, but a more
generic solution is to implement cputime_max() and use the cputime_gt()
function for comparison.

Reported-by: spencer@bluehost.com
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
fs/proc/array.c
include/linux/sched.h
kernel/exit.c
kernel/sched.c