aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/array.c3
-rw-r--r--include/linux/sched.h1
-rw-r--r--kernel/fork.c1
3 files changed, 4 insertions, 1 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 63c95afb561f..d80baaabf835 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -358,7 +358,8 @@ static cputime_t task_utime(struct task_struct *p)
358 } 358 }
359 utime = (clock_t)temp; 359 utime = (clock_t)temp;
360 360
361 return clock_t_to_cputime(utime); 361 p->prev_utime = max(p->prev_utime, clock_t_to_cputime(utime));
362 return p->prev_utime;
362} 363}
363 364
364static cputime_t task_stime(struct task_struct *p) 365static cputime_t task_stime(struct task_struct *p)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3c07d595979f..b0b1fe6e0b17 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1009,6 +1009,7 @@ struct task_struct {
1009 unsigned int rt_priority; 1009 unsigned int rt_priority;
1010 cputime_t utime, stime, utimescaled, stimescaled; 1010 cputime_t utime, stime, utimescaled, stimescaled;
1011 cputime_t gtime; 1011 cputime_t gtime;
1012 cputime_t prev_utime;
1012 unsigned long nvcsw, nivcsw; /* context switch counts */ 1013 unsigned long nvcsw, nivcsw; /* context switch counts */
1013 struct timespec start_time; /* monotonic time */ 1014 struct timespec start_time; /* monotonic time */
1014 struct timespec real_start_time; /* boot based time */ 1015 struct timespec real_start_time; /* boot based time */
diff --git a/kernel/fork.c b/kernel/fork.c
index ddafdfac9456..a65bfc47177c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1056,6 +1056,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1056 p->gtime = cputime_zero; 1056 p->gtime = cputime_zero;
1057 p->utimescaled = cputime_zero; 1057 p->utimescaled = cputime_zero;
1058 p->stimescaled = cputime_zero; 1058 p->stimescaled = cputime_zero;
1059 p->prev_utime = cputime_zero;
1059 1060
1060#ifdef CONFIG_TASK_XACCT 1061#ifdef CONFIG_TASK_XACCT
1061 p->rchar = 0; /* I/O counter: bytes read */ 1062 p->rchar = 0; /* I/O counter: bytes read */