Commit 5968cece authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Ingo Molnar

sched/stat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO=y

Expand /proc/pid/schedstat output:

 - enable it on CONFIG_TASK_DELAY_ACCT=y && !CONFIG_SCHEDSTATS kernels.

 - dump all zeroes on kernels that are booted with the 'nodelayacct'
   option, which boot option disables delay accounting on
   CONFIG_TASK_DELAY_ACCT=y kernels.
Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: a.p.zijlstra@chello.nl
Cc: ricklind@us.ibm.com
Link: http://lkml.kernel.org/r/5ccbef17d4bc841084ea6e6421d4e4a23b7b806f.1435654789.git.naveen.n.rao@linux.vnet.ibm.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent f6db8347
...@@ -304,13 +304,16 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, ...@@ -304,13 +304,16 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns,
} }
#endif #endif
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHED_INFO
/* /*
* Provides /proc/PID/schedstat * Provides /proc/PID/schedstat
*/ */
static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns, static int proc_pid_schedstat(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task) struct pid *pid, struct task_struct *task)
{ {
if (unlikely(!sched_info_on()))
seq_printf(m, "0 0 0\n");
else
seq_printf(m, "%llu %llu %lu\n", seq_printf(m, "%llu %llu %lu\n",
(unsigned long long)task->se.sum_exec_runtime, (unsigned long long)task->se.sum_exec_runtime,
(unsigned long long)task->sched_info.run_delay, (unsigned long long)task->sched_info.run_delay,
...@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = { ...@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = {
#ifdef CONFIG_STACKTRACE #ifdef CONFIG_STACKTRACE
ONE("stack", S_IRUSR, proc_pid_stack), ONE("stack", S_IRUSR, proc_pid_stack),
#endif #endif
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHED_INFO
ONE("schedstat", S_IRUGO, proc_pid_schedstat), ONE("schedstat", S_IRUGO, proc_pid_schedstat),
#endif #endif
#ifdef CONFIG_LATENCYTOP #ifdef CONFIG_LATENCYTOP
...@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = { ...@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = {
#ifdef CONFIG_STACKTRACE #ifdef CONFIG_STACKTRACE
ONE("stack", S_IRUSR, proc_pid_stack), ONE("stack", S_IRUSR, proc_pid_stack),
#endif #endif
#ifdef CONFIG_SCHEDSTATS #ifdef CONFIG_SCHED_INFO
ONE("schedstat", S_IRUGO, proc_pid_schedstat), ONE("schedstat", S_IRUGO, proc_pid_schedstat),
#endif #endif
#ifdef CONFIG_LATENCYTOP #ifdef CONFIG_LATENCYTOP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment