diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-09-05 18:12:23 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-08 20:22:56 -0700 |
commit | 092609f380fe84ab974062729942ba6b0be3a78f (patch) | |
tree | 02c4431d19c6de22656ccf1efe2f32928011c259 /include | |
parent | 1fac74ef6eb3ac9e7355c3d43803ef8ec9c0971f (diff) | |
download | linux-stable-092609f380fe84ab974062729942ba6b0be3a78f.tar.gz linux-stable-092609f380fe84ab974062729942ba6b0be3a78f.tar.bz2 linux-stable-092609f380fe84ab974062729942ba6b0be3a78f.zip |
sched: fix process time monotonicity
commit 49048622eae698e5c4ae61f7e71200f265ccc529 upstream
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index c5d3f847ca8d..2103c739c90f 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1477,6 +1477,10 @@ static inline void put_task_struct(struct task_struct *t) __put_task_struct(t); } +extern cputime_t task_utime(struct task_struct *p); +extern cputime_t task_stime(struct task_struct *p); +extern cputime_t task_gtime(struct task_struct *p); + /* * Per process flags */ |