aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/array.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-01-13 01:06:28 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-01-13 01:06:28 -0500
commitf43dc23d5ea91fca257be02138a255f02d98e806 (patch)
treeb29722f6e965316e90ac97abf79923ced250dc21 /fs/proc/array.c
parentf8e53553f452dcbf67cb89c8cba63a1cd6eb4cc0 (diff)
parent4162cf64973df51fc885825bc9ca4d055891c49f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 into common/serial-rework
Conflicts: arch/sh/kernel/cpu/sh2/setup-sh7619.c arch/sh/kernel/cpu/sh2a/setup-mxg.c arch/sh/kernel/cpu/sh2a/setup-sh7201.c arch/sh/kernel/cpu/sh2a/setup-sh7203.c arch/sh/kernel/cpu/sh2a/setup-sh7206.c arch/sh/kernel/cpu/sh3/setup-sh7705.c arch/sh/kernel/cpu/sh3/setup-sh770x.c arch/sh/kernel/cpu/sh3/setup-sh7710.c arch/sh/kernel/cpu/sh3/setup-sh7720.c arch/sh/kernel/cpu/sh4/setup-sh4-202.c arch/sh/kernel/cpu/sh4/setup-sh7750.c arch/sh/kernel/cpu/sh4/setup-sh7760.c arch/sh/kernel/cpu/sh4a/setup-sh7343.c arch/sh/kernel/cpu/sh4a/setup-sh7366.c arch/sh/kernel/cpu/sh4a/setup-sh7722.c arch/sh/kernel/cpu/sh4a/setup-sh7723.c arch/sh/kernel/cpu/sh4a/setup-sh7724.c arch/sh/kernel/cpu/sh4a/setup-sh7763.c arch/sh/kernel/cpu/sh4a/setup-sh7770.c arch/sh/kernel/cpu/sh4a/setup-sh7780.c arch/sh/kernel/cpu/sh4a/setup-sh7785.c arch/sh/kernel/cpu/sh4a/setup-sh7786.c arch/sh/kernel/cpu/sh4a/setup-shx3.c arch/sh/kernel/cpu/sh5/setup-sh5.c drivers/serial/sh-sci.c drivers/serial/sh-sci.h include/linux/serial_sci.h
Diffstat (limited to 'fs/proc/array.c')
-rw-r--r--fs/proc/array.c55
1 files changed, 34 insertions, 21 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index 725a650bbbb8..fff6572676ae 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -68,7 +68,6 @@
68#include <linux/hugetlb.h> 68#include <linux/hugetlb.h>
69#include <linux/pagemap.h> 69#include <linux/pagemap.h>
70#include <linux/swap.h> 70#include <linux/swap.h>
71#include <linux/slab.h>
72#include <linux/smp.h> 71#include <linux/smp.h>
73#include <linux/signal.h> 72#include <linux/signal.h>
74#include <linux/highmem.h> 73#include <linux/highmem.h>
@@ -133,13 +132,16 @@ static inline void task_name(struct seq_file *m, struct task_struct *p)
133 * simple bit tests. 132 * simple bit tests.
134 */ 133 */
135static const char *task_state_array[] = { 134static const char *task_state_array[] = {
136 "R (running)", /* 0 */ 135 "R (running)", /* 0 */
137 "S (sleeping)", /* 1 */ 136 "S (sleeping)", /* 1 */
138 "D (disk sleep)", /* 2 */ 137 "D (disk sleep)", /* 2 */
139 "T (stopped)", /* 4 */ 138 "T (stopped)", /* 4 */
140 "T (tracing stop)", /* 8 */ 139 "t (tracing stop)", /* 8 */
141 "Z (zombie)", /* 16 */ 140 "Z (zombie)", /* 16 */
142 "X (dead)" /* 32 */ 141 "X (dead)", /* 32 */
142 "x (dead)", /* 64 */
143 "K (wakekill)", /* 128 */
144 "W (waking)", /* 256 */
143}; 145};
144 146
145static inline const char *get_task_state(struct task_struct *tsk) 147static inline const char *get_task_state(struct task_struct *tsk)
@@ -147,6 +149,8 @@ static inline const char *get_task_state(struct task_struct *tsk)
147 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state; 149 unsigned int state = (tsk->state & TASK_REPORT) | tsk->exit_state;
148 const char **p = &task_state_array[0]; 150 const char **p = &task_state_array[0];
149 151
152 BUILD_BUG_ON(1 + ilog2(TASK_STATE_MAX) != ARRAY_SIZE(task_state_array));
153
150 while (state) { 154 while (state) {
151 p++; 155 p++;
152 state >>= 1; 156 state >>= 1;
@@ -172,7 +176,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns,
172 if (tracer) 176 if (tracer)
173 tpid = task_pid_nr_ns(tracer, ns); 177 tpid = task_pid_nr_ns(tracer, ns);
174 } 178 }
175 cred = get_cred((struct cred *) __task_cred(p)); 179 cred = get_task_cred(p);
176 seq_printf(m, 180 seq_printf(m,
177 "State:\t%s\n" 181 "State:\t%s\n"
178 "Tgid:\t%d\n" 182 "Tgid:\t%d\n"
@@ -263,9 +267,11 @@ static inline void task_sig(struct seq_file *m, struct task_struct *p)
263 shpending = p->signal->shared_pending.signal; 267 shpending = p->signal->shared_pending.signal;
264 blocked = p->blocked; 268 blocked = p->blocked;
265 collect_sigign_sigcatch(p, &ignored, &caught); 269 collect_sigign_sigcatch(p, &ignored, &caught);
266 num_threads = atomic_read(&p->signal->count); 270 num_threads = get_nr_threads(p);
271 rcu_read_lock(); /* FIXME: is this correct? */
267 qsize = atomic_read(&__task_cred(p)->user->sigpending); 272 qsize = atomic_read(&__task_cred(p)->user->sigpending);
268 qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur; 273 rcu_read_unlock();
274 qlim = task_rlimit(p, RLIMIT_SIGPENDING);
269 unlock_task_sighand(p, &flags); 275 unlock_task_sighand(p, &flags);
270 } 276 }
271 277
@@ -321,6 +327,16 @@ static inline void task_context_switch_counts(struct seq_file *m,
321 p->nivcsw); 327 p->nivcsw);
322} 328}
323 329
330static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
331{
332 seq_printf(m, "Cpus_allowed:\t");
333 seq_cpumask(m, &task->cpus_allowed);
334 seq_printf(m, "\n");
335 seq_printf(m, "Cpus_allowed_list:\t");
336 seq_cpumask_list(m, &task->cpus_allowed);
337 seq_printf(m, "\n");
338}
339
324int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, 340int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
325 struct pid *pid, struct task_struct *task) 341 struct pid *pid, struct task_struct *task)
326{ 342{
@@ -335,6 +351,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
335 } 351 }
336 task_sig(m, task); 352 task_sig(m, task);
337 task_cap(m, task); 353 task_cap(m, task);
354 task_cpus_allowed(m, task);
338 cpuset_task_status_allowed(m, task); 355 cpuset_task_status_allowed(m, task);
339#if defined(CONFIG_S390) 356#if defined(CONFIG_S390)
340 task_show_regs(m, task); 357 task_show_regs(m, task);
@@ -393,7 +410,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
393 tty_nr = new_encode_dev(tty_devnum(sig->tty)); 410 tty_nr = new_encode_dev(tty_devnum(sig->tty));
394 } 411 }
395 412
396 num_threads = atomic_read(&sig->count); 413 num_threads = get_nr_threads(task);
397 collect_sigign_sigcatch(task, &sigign, &sigcatch); 414 collect_sigign_sigcatch(task, &sigign, &sigcatch);
398 415
399 cmin_flt = sig->cmin_flt; 416 cmin_flt = sig->cmin_flt;
@@ -401,24 +418,21 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
401 cutime = sig->cutime; 418 cutime = sig->cutime;
402 cstime = sig->cstime; 419 cstime = sig->cstime;
403 cgtime = sig->cgtime; 420 cgtime = sig->cgtime;
404 rsslim = sig->rlim[RLIMIT_RSS].rlim_cur; 421 rsslim = ACCESS_ONCE(sig->rlim[RLIMIT_RSS].rlim_cur);
405 422
406 /* add up live thread stats at the group level */ 423 /* add up live thread stats at the group level */
407 if (whole) { 424 if (whole) {
408 struct task_cputime cputime;
409 struct task_struct *t = task; 425 struct task_struct *t = task;
410 do { 426 do {
411 min_flt += t->min_flt; 427 min_flt += t->min_flt;
412 maj_flt += t->maj_flt; 428 maj_flt += t->maj_flt;
413 gtime = cputime_add(gtime, task_gtime(t)); 429 gtime = cputime_add(gtime, t->gtime);
414 t = next_thread(t); 430 t = next_thread(t);
415 } while (t != task); 431 } while (t != task);
416 432
417 min_flt += sig->min_flt; 433 min_flt += sig->min_flt;
418 maj_flt += sig->maj_flt; 434 maj_flt += sig->maj_flt;
419 thread_group_cputime(task, &cputime); 435 thread_group_times(task, &utime, &stime);
420 utime = cputime.utime;
421 stime = cputime.stime;
422 gtime = cputime_add(gtime, sig->gtime); 436 gtime = cputime_add(gtime, sig->gtime);
423 } 437 }
424 438
@@ -434,9 +448,8 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
434 if (!whole) { 448 if (!whole) {
435 min_flt = task->min_flt; 449 min_flt = task->min_flt;
436 maj_flt = task->maj_flt; 450 maj_flt = task->maj_flt;
437 utime = task_utime(task); 451 task_times(task, &utime, &stime);
438 stime = task_stime(task); 452 gtime = task->gtime;
439 gtime = task_gtime(task);
440 } 453 }
441 454
442 /* scale priority and nice values from timeslices to -20..20 */ 455 /* scale priority and nice values from timeslices to -20..20 */