Still seeing decreasing stime/utime
Subsystems (2)
Forgot to cc lkml (the original email did not either, but I need comments on the patch).
Signature · 1 line
Balbir
Quoted 5 lines · Spencer Candland
Yes,
CONFIG_VIRT_CPU_ACCOUNTINGis not enabled, I am seeing this on x86/x86_64.I can not seem to duplicate this when booting with nosmp.
Thanks for the config and the update. I ran the same test on a quad core machine on 2.6.27-rc3 (mmotm a few days old) (x86_64)
50 600
52 658
58 706
62 760
66 810
70 864
72 914
78 964
...
Here is an experimental patch (I've just compiled and booted a machine with it, I am unable to reproduce your problem), could you please test it for me and see if it helps solve the problem
Spencer Candland 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.
Comments? (If the inline functions don't look good, I'll gladly move the functions over to sched.c)
---
fs/proc/array.c | 59 -------------------------------------------------- include/linux/sched.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/exit.c | 6 ++--- 3 files changed, 62 insertions(+), 62 deletions(-)
kernel/exit.c renamed from kernel/exit.c~fix-utime-stime-moving-backwards +3 -3
@@ -115,9 +115,9 @@ static void __exit_signal(struct task_st* We won't ever get here for the group leader, since it * will have been the last reference on the signal_struct. */ - sig->utime =cputime_add (sig->utime, tsk->utime); - sig->stime =cputime_add (sig->stime, tsk->stime); - sig->gtime =cputime_add (sig->gtime, tsk->gtime); + sig->utime =cputime_add (sig->utime,task_utime (tsk)); + sig->stime =cputime_add (sig->stime,task_stime (tsk)); + sig->gtime =cputime_add (sig->gtime,task_gtime (tsk)); sig->min_flt += tsk->min_flt; sig->maj_flt += tsk->maj_flt; sig->nvcsw += tsk->nvcsw;
fs/proc/array.c renamed from fs/proc/array.c~fix-utime-stime-moving-backwards +0 -59
65 lines not on this page · raw message
include/linux/sched.h renamed from include/linux/sched.h~fix-utime-stime-moving-backwards +59 -0
65 lines not on this page · raw message
_
Signature · 1 line
Balbir