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.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 07f77a7945c3..f560325c444f 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -134,13 +134,16 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
134 * simple bit tests. 134 * simple bit tests.
135 */ 135 */
136static const char *task_state_array[] = { 136static const char *task_state_array[] = {
137 "R (running)", /* 0 */ 137 "R (running)", /* 0 */
138 "S (sleeping)", /* 1 */ 138 "S (sleeping)", /* 1 */
139 "D (disk sleep)", /* 2 */ 139 "D (disk sleep)", /* 2 */
140 "T (stopped)", /* 4 */ 140 "T (stopped)", /* 4 */
141 "T (tracing stop)", /* 8 */ 141 "t (tracing stop)", /* 8 */
142 "Z (zombie)", /* 16 */ 142 "Z (zombie)", /* 16 */
143 "X (dead)" /* 32 */ 143 "X (dead)", /* 32 */
144 "x (dead)", /* 64 */
145 "K (wakekill)", /* 128 */
146 "W (waking)", /* 256 */
144}; 147};
145 148
146static inline const char *get_task_state(struct task_struct *tsk) 149static inline const char *get_task_state(struct task_struct *tsk)
@@ -148,6 +151,8 @@ static inline const char *get_task_state(struct task_struct *tsk)
148 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; 151 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state;
149 const char **p = &task_state_array[0]; 152 const char **p = &task_state_array[0];
150 153
154 BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array));
155
151 while (state) { 156 while (state) {
152 p++; 157 p++;
153 state >>= 1; 158 state >>= 1;
@@ -410,6 +415,16 @@ static void task_show_stack_usage(struct seq_file *m, struct task_struct *task)
410} 415}
411#endif /* CONFIG_MMU */ 416#endif /* CONFIG_MMU */
412 417
418static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
419{
420 seq_printf(m, "Cpus_allowed:\t");
421 seq_cpumask(m, &task->cpus_allowed);
422 seq_printf(m, "\n");
423 seq_printf(m, "Cpus_allowed_list:\t");
424 seq_cpumask_list(m, &task->cpus_allowed);
425 seq_printf(m, "\n");
426}
427
413int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, 428int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
414 struct pid *pid, struct task_struct *task) 429 struct pid *pid, struct task_struct *task)
415{ 430{
@@ -424,6 +439,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
424 } 439 }
425 task_sig(m, task); 440 task_sig(m, task);
426 task_cap(m, task); 441 task_cap(m, task);
442 task_cpus_allowed(m, task);
427 cpuset_task_status_allowed(m, task); 443 cpuset_task_status_allowed(m, task);
428#if defined(CONFIG_S390) 444#if defined(CONFIG_S390)
429 task_show_regs(m, task); 445 task_show_regs(m, task);
@@ -495,20 +511,17 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
495 511
496 /* add up live thread stats at the group level */ 512 /* add up live thread stats at the group level */
497 if (whole) { 513 if (whole) {
498 struct task_cputime cputime;
499 struct task_struct *t = task; 514 struct task_struct *t = task;
500 do { 515 do {
501 min_flt += t->min_flt; 516 min_flt += t->min_flt;
502 maj_flt += t->maj_flt; 517 maj_flt += t->maj_flt;
503 gtime = cputime_add(gtime, task_gtime(t)); 518 gtime = cputime_add(gtime, t->gtime);
504 t = next_thread(t); 519 t = next_thread(t);
505 } while (t != task); 520 } while (t != task);
506 521
507 min_flt += sig->min_flt; 522 min_flt += sig->min_flt;
508 maj_flt += sig->maj_flt; 523 maj_flt += sig->maj_flt;
509 thread_group_cputime(task, &cputime); 524 thread_group_times(task, &utime, &stime);
510 utime = cputime.utime;
511 stime = cputime.stime;
512 gtime = cputime_add(gtime, sig->gtime); 525 gtime = cputime_add(gtime, sig->gtime);
513 } 526 }
514 527
@@ -524,9 +537,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
524 if (!whole) { 537 if (!whole) {
525 min_flt = task->min_flt; 538 min_flt = task->min_flt;
526 maj_flt = task->maj_flt; 539 maj_flt = task->maj_flt;
527 utime = task_utime(task); 540 task_times(task, &utime, &stime);
528 stime = task_stime(task); 541 gtime = task->gtime;
529 gtime = task_gtime(task);
530 } 542 }
531 543
532 /* scale priority and nice values from timeslices to -20..20 */ 544 /* scale priority and nice values from timeslices to -20..20 */
@@ -571,7 +583,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
571 rsslim, 583 rsslim,
572 mm ? mm->start_code : 0, 584 mm ? mm->start_code : 0,
573 mm ? mm->end_code : 0, 585 mm ? mm->end_code : 0,
574 (permitted) ? task->stack_start : 0, 586 (permitted && mm) ? task->stack_start : 0,
575 esp, 587 esp,
576 eip, 588 eip,
577 /* The signal information here is obsolete. 589 /* The signal information here is obsolete.