diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-09-24 03:56:20 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-09-24 03:56:20 -0400 |
| commit | ebdd90a8cb2e3963f55499850f02ce6003558b55 (patch) | |
| tree | d153f917ed41d257ddafa22f9cc2201bfddf8f9c /fs/proc/array.c | |
| parent | 3c9339049df5cc3a468c11de6c4101a1ea8c3d83 (diff) | |
| parent | 72d31053f62c4bc464c2783974926969614a8649 (diff) | |
Merge commit 'v2.6.27-rc7' into x86/pebs
Diffstat (limited to 'fs/proc/array.c')
| -rw-r--r-- | fs/proc/array.c | 68 |
1 files changed, 7 insertions, 61 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c index 797d775e0354..71c9be59c9c2 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
| @@ -80,6 +80,7 @@ | |||
| 80 | #include <linux/delayacct.h> | 80 | #include <linux/delayacct.h> |
| 81 | #include <linux/seq_file.h> | 81 | #include <linux/seq_file.h> |
| 82 | #include <linux/pid_namespace.h> | 82 | #include <linux/pid_namespace.h> |
| 83 | #include <linux/tracehook.h> | ||
| 83 | 84 | ||
| 84 | #include <asm/pgtable.h> | 85 | #include <asm/pgtable.h> |
| 85 | #include <asm/processor.h> | 86 | #include <asm/processor.h> |
| @@ -168,8 +169,12 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
| 168 | rcu_read_lock(); | 169 | rcu_read_lock(); |
| 169 | ppid = pid_alive(p) ? | 170 | ppid = pid_alive(p) ? |
| 170 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; | 171 | task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0; |
| 171 | tpid = pid_alive(p) && p->ptrace ? | 172 | tpid = 0; |
| 172 | task_pid_nr_ns(rcu_dereference(p->parent), ns) : 0; | 173 | if (pid_alive(p)) { |
| 174 | struct task_struct *tracer = tracehook_tracer_task(p); | ||
| 175 | if (tracer) | ||
| 176 | tpid = task_pid_nr_ns(tracer, ns); | ||
| 177 | } | ||
| 173 | seq_printf(m, | 178 | seq_printf(m, |
| 174 | "State:\t%s\n" | 179 | "State:\t%s\n" |
| 175 | "Tgid:\t%d\n" | 180 | "Tgid:\t%d\n" |
| @@ -332,65 +337,6 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | |||
| 332 | return 0; | 337 | return 0; |
| 333 | } | 338 | } |
| 334 | 339 | ||
| 335 | /* | ||
| 336 | * Use precise platform statistics if available: | ||
| 337 | */ | ||
| 338 | #ifdef CONFIG_VIRT_CPU_ACCOUNTING | ||
| 339 | static cputime_t task_utime(struct task_struct *p) | ||
| 340 | { | ||
| 341 | return p->utime; | ||
| 342 | } | ||
| 343 | |||
| 344 | static cputime_t task_stime(struct task_struct *p) | ||
| 345 | { | ||
| 346 | return p->stime; | ||
| 347 | } | ||
| 348 | #else | ||
| 349 | static cputime_t task_utime(struct task_struct *p) | ||
| 350 | { | ||
| 351 | clock_t utime = cputime_to_clock_t(p->utime), | ||
| 352 | total = utime + cputime_to_clock_t(p->stime); | ||
| 353 | u64 temp; | ||
| 354 | |||
| 355 | /* | ||
| 356 | * Use CFS's precise accounting: | ||
| 357 | */ | ||
| 358 | temp = (u64)nsec_to_clock_t(p->se.sum_exec_runtime); | ||
| 359 | |||
| 360 | if (total) { | ||
| 361 | temp *= utime; | ||
| 362 | do_div(temp, total); | ||
| 363 | } | ||
| 364 | utime = (clock_t)temp; | ||
| 365 | |||
| 366 | p->prev_utime = max(p->prev_utime, clock_t_to_cputime(utime)); | ||
| 367 | return p->prev_utime; | ||
| 368 | } | ||
| 369 | |||
| 370 | static cputime_t task_stime(struct task_struct *p) | ||
| 371 | { | ||
| 372 | clock_t stime; | ||
| 373 | |||
| 374 | /* | ||
| 375 | * Use CFS's precise accounting. (we subtract utime from | ||
| 376 | * the total, to make sure the total observed by userspace | ||
| 377 | * grows monotonically - apps rely on that): | ||
| 378 | */ | ||
| 379 | stime = nsec_to_clock_t(p->se.sum_exec_runtime) - | ||
| 380 | cputime_to_clock_t(task_utime(p)); | ||
| 381 | |||
| 382 | if (stime >= 0) | ||
| 383 | p->prev_stime = max(p->prev_stime, clock_t_to_cputime(stime)); | ||
| 384 | |||
| 385 | return p->prev_stime; | ||
| 386 | } | ||
| 387 | #endif | ||
| 388 | |||
| 389 | static cputime_t task_gtime(struct task_struct *p) | ||
| 390 | { | ||
| 391 | return p->gtime; | ||
| 392 | } | ||
| 393 | |||
| 394 | static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, | 340 | static int do_task_stat(struct seq_file *m, struct pid_namespace *ns, |
| 395 | struct pid *pid, struct task_struct *task, int whole) | 341 | struct pid *pid, struct task_struct *task, int whole) |
| 396 | { | 342 | { |
