aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 63c95afb561f..b380313092bd 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -141,12 +141,7 @@ static const char *task_state_array[] = {
141 141
142static inline const char *get_task_state(struct task_struct *tsk) 142static inline const char *get_task_state(struct task_struct *tsk)
143{ 143{
144 unsigned int state = (tsk->state & (TASK_RUNNING | 144 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state;
145 TASK_INTERRUPTIBLE |
146 TASK_UNINTERRUPTIBLE |
147 TASK_STOPPED |
148 TASK_TRACED)) |
149 tsk->exit_state;
150 const char **p = &task_state_array[0]; 145 const char **p = &task_state_array[0];
151 146
152 while (state) { 147 while (state) {
@@ -169,7 +164,7 @@ static inline char *task_state(struct task_struct *p, char *buffer)
169 ppid = pid_alive(p) ? 164 ppid = pid_alive(p) ?
170 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; 165 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
171 tpid = pid_alive(p) && p->ptrace ? 166 tpid = pid_alive(p) && p->ptrace ?
172 task_ppid_nr_ns(rcu_dereference(p->parent), ns) : 0; 167 task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0;
173 buffer += sprintf(buffer, 168 buffer += sprintf(buffer,
174 "State:\t%s\n" 169 "State:\t%s\n"
175 "Tgid:\t%d\n" 170 "Tgid:\t%d\n"
@@ -358,7 +353,8 @@ static cputime_t task_utime(struct task_struct *p)
358 } 353 }
359 utime = (clock_t)temp; 354 utime = (clock_t)temp;
360 355
361 return clock_t_to_cputime(utime); 356 p->prev_utime = max(p->prev_utime, clock_t_to_cputime(utime));
357 return p->prev_utime;
362} 358}
363 359
364static cputime_t task_stime(struct task_struct *p) 360static cputime_t task_stime(struct task_struct *p)
@@ -373,7 +369,10 @@ static cputime_t task_stime(struct task_struct *p)
373 stime = nsec_to_clock_t(p->se.sum_exec_runtime) - 369 stime = nsec_to_clock_t(p->se.sum_exec_runtime) -
374 cputime_to_clock_t(task_utime(p)); 370 cputime_to_clock_t(task_utime(p));
375 371
376 return clock_t_to_cputime(stime); 372 if (stime >= 0)
373 p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime));
374
375 return p->prev_stime;
377} 376}
378#endif 377#endif
379 378
@@ -460,8 +459,8 @@ static int do_task_stat(struct task_struct *task, char *buffer, int whole)
460 } 459 }
461 460
462 sid = task_session_nr_ns(task, ns); 461 sid = task_session_nr_ns(task, ns);
462 ppid = task_tgid_nr_ns(task->real_parent, ns);
463 pgid = task_pgrp_nr_ns(task, ns); 463 pgid = task_pgrp_nr_ns(task, ns);
464 ppid = task_ppid_nr_ns(task, ns);
465 464
466 unlock_task_sighand(task, &flags); 465 unlock_task_sighand(task, &flags);
467 } 466 }