diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2008-09-05 12:12:23 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-05 12:14:35 -0400 |
commit | 49048622eae698e5c4ae61f7e71200f265ccc529 (patch) | |
tree | e568595fe5329e1293eafc3a3cc833dfe89ffbf2 /include/linux/sched.h | |
parent | 56c7426b3951e4f35a71d695f1c982989399d6fd (diff) |
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>
Diffstat (limited to 'include/linux/sched.h')
-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 cfb0d87b99fc..3d9120c5ad15 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1475,6 +1475,10 @@ static inline void put_task_struct(struct task_struct *t) | |||
1475 | __put_task_struct(t); | 1475 | __put_task_struct(t); |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | extern cputime_t task_utime(struct task_struct *p); | ||
1479 | extern cputime_t task_stime(struct task_struct *p); | ||
1480 | extern cputime_t task_gtime(struct task_struct *p); | ||
1481 | |||
1478 | /* | 1482 | /* |
1479 | * Per process flags | 1483 | * Per process flags |
1480 | */ | 1484 | */ |