Clean up schedstat and task delay acct config options
Subsystems (3)
v2 cover Clean up schedstat and task delay acct config options
Further to the earlier discussion [1], this patch set introduces CONFIG_SCHED_INFO for the common code associated with CONFIG_SCHEDSTATS and CONFIG_TASK_DELAY_ACCT. Further, /proc/<pid>/schedstat is now exposed if either of these is enabled.
[1] http://thread.gmane.org/gmane.linux.kernel/1961707
- Naveen
Naveen N. Rao (2):
schedstat: Simplify sched_info accounting dependency
schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
fs/proc/base.c | 11 +++++++---- include/linux/sched.h | 6 +++--- init/Kconfig | 1 + kernel/sched/core.c | 2 +- kernel/sched/stats.h | 4 ++-- lib/Kconfig.debug | 5 +++++ 6 files changed, 19 insertions(+), 10 deletions(-)
Signature · 1 line
2.4.0
PATCH v2 1/2 schedstat: Simplify sched_info accounting dependency
Both CONFIG_SCHEDSTATS and CONFIG_TASK_DELAY_ACCT track task sched_info. Simplify by introducing a common CONFIG_SCHED_INFO selected by both.
--- include/linux/sched.h | 6 +++--- init/Kconfig | 1 + kernel/sched/core.c | 2 +- kernel/sched/stats.h | 4 ++-- lib/Kconfig.debug | 5 +++++ 5 files changed, 12 insertions(+), 6 deletions(-)
include/linux/sched.h +3 -3
@@ -849,7 +849,7 @@ extern struct user_struct root_user;struct backing_dev_info ;struct reclaim_state ; -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) +#ifdef CONFIG_SCHED_INFO struct sched_info { /* cumulative counters */ unsigned long pcount; /* # of times run on this cpu */
@@ -859,7 +859,7 @@ struct sched_info {unsigned long long last_arrival,/* when we last ran on a cpu */ last_queued;/* when we were last queued to run */ }; -#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ +#endif /* CONFIG_SCHED_INFO */ #ifdef CONFIG_TASK_DELAY_ACCT struct task_delay_info {
@@ -1408,7 +1408,7 @@ struct task_struct {int rcu_tasks_idle_cpu;#endif /* #ifdef CONFIG_TASKS_RCU */ -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO struct sched_info sched_info;#endif
init/Kconfig +1 -0
@@ -435,6 +435,7 @@ config TASKSTATS config TASK_DELAY_ACCT bool "Enable per-task delay accounting" depends on TASKSTATS + select SCHED_INFO help Collect information on time spent by a task waiting for system resources like cpu, synchronous block I/O completion and swapping
kernel/sched/core.c +1 -1
@@ -2164,7 +2164,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)set_task_cpu (p, cpu);raw_spin_unlock_irqrestore (&p->pi_lock, flags); -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO if (likely (sched_info_on ()))memset (&p->sched_info,0 ,sizeof (p->sched_info));#endif
kernel/sched/stats.h +2 -2
@@ -47,7 +47,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)# define schedstat_set (var, val) do { } while (0)#endif -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO static inline void sched_info_reset_dequeued (struct task_struct *t) { t->sched_info.last_queued =0 ;
@@ -156,7 +156,7 @@ sched_info_switch(struct rq *rq,#define sched_info_depart (rq, t) do { } while (0)#define sched_info_arrive (rq, next) do { } while (0)#define sched_info_switch (rq, t, next) do { } while (0) -#endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */ +#endif /* CONFIG_SCHED_INFO */ /* * The following are functions that support scheduler-internal time accounting.
lib/Kconfig.debug +5 -0
@@ -841,9 +841,14 @@ config SCHED_DEBUG that can help debug the scheduler. The runtime overhead of this option is minimal. +config SCHED_INFO + bool + default n + config SCHEDSTATS bool "Collect scheduler statistics" depends on DEBUG_KERNEL && PROC_FS + select SCHED_INFO help If you say Y here, additional code will be inserted into the scheduler and related routines to collect statistics about
Signature · 1 line
2.4.0
Re: [PATCH v2 1/2] schedstat: Simplify sched_info accounting dependency
Quoted 5 lines · Naveen N. Rao
Both
CONFIG_SCHEDSTATSandCONFIG_TASK_DELAY_ACCTtrack tasksched_info. Simplify by introducing a commonCONFIG_SCHED_INFOselected by both.Signed-off-by Naveen N. Rao <[email protected]>---
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
Balbir Singh
Acked-byRe: [PATCH v2 1/2] schedstat: Simplify sched_info accounting dependency
Quoted 11 lines · Srikar Dronamraju
Quoted 5 lines · Naveen N. Rao
Both
CONFIG_SCHEDSTATSandCONFIG_TASK_DELAY_ACCTtrack tasksched_info. Simplify by introducing a commonCONFIG_SCHED_INFOselected by both.Signed-off-by Naveen N. Rao <[email protected]>---
Looks good to me.
tip-bot for Naveen N. Rao
merge bot[tip:sched/urgent] sched/stat: Simplify the sched_info accounting dependency
In reply to Naveen N. Raosched/stat: Simplify the sched_info accounting dependency
Commit-ID: 640032ed8d55bf6f09b0701e7464aab7e24e0361 Gitweb: http://git.kernel.org/tip/640032ed8d55bf6f09b0701e7464aab7e24e0361 Author: Naveen N. Rao <[email protected]> AuthorDate: Thu, 25 Jun 2015 23:53:37 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2015 10:02:58 +0200
sched/stat: Simplify the sched_info accounting dependency
Both CONFIG_SCHEDSTATS=y and CONFIG_TASK_DELAY_ACCT=y track task sched_info, which results in ugly #if clauses.
Simplify the code by introducing a synthethic CONFIG_SCHED_INFO switch, selected by both.
--- include/linux/sched.h | 6 +++--- init/Kconfig | 1 + kernel/sched/core.c | 2 +- kernel/sched/stats.h | 4 ++-- lib/Kconfig.debug | 5 +++++ 5 files changed, 12 insertions(+), 6 deletions(-)
include/linux/sched.h +3 -3
@@ -849,7 +849,7 @@ extern struct user_struct root_user;struct backing_dev_info ;struct reclaim_state ; -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) +#ifdef CONFIG_SCHED_INFO struct sched_info { /* cumulative counters */ unsigned long pcount; /* # of times run on this cpu */
@@ -859,7 +859,7 @@ struct sched_info {unsigned long long last_arrival,/* when we last ran on a cpu */ last_queued;/* when we were last queued to run */ }; -#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ +#endif /* CONFIG_SCHED_INFO */ #ifdef CONFIG_TASK_DELAY_ACCT struct task_delay_info {
@@ -1408,7 +1408,7 @@ struct task_struct {int rcu_tasks_idle_cpu;#endif /* #ifdef CONFIG_TASKS_RCU */ -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO struct sched_info sched_info;#endif
init/Kconfig +1 -0
@@ -435,6 +435,7 @@ config TASKSTATS config TASK_DELAY_ACCT bool "Enable per-task delay accounting" depends on TASKSTATS + select SCHED_INFO help Collect information on time spent by a task waiting for system resources like cpu, synchronous block I/O completion and swapping
kernel/sched/core.c +1 -1
@@ -1975,7 +1975,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)set_task_cpu (p, cpu);raw_spin_unlock_irqrestore (&p->pi_lock, flags); -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO if (likely (sched_info_on ()))memset (&p->sched_info,0 ,sizeof (p->sched_info));#endif
kernel/sched/stats.h +2 -2
@@ -47,7 +47,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)# define schedstat_set (var, val) do { } while (0)#endif -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO static inline void sched_info_reset_dequeued (struct task_struct *t) { t->sched_info.last_queued =0 ;
@@ -156,7 +156,7 @@ sched_info_switch(struct rq *rq,#define sched_info_depart (rq, t) do { } while (0)#define sched_info_arrive (rq, next) do { } while (0)#define sched_info_switch (rq, t, next) do { } while (0) -#endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */ +#endif /* CONFIG_SCHED_INFO */ /* * The following are functions that support scheduler-internal time accounting.
lib/Kconfig.debug +5 -0
@@ -841,9 +841,14 @@ config SCHED_DEBUG that can help debug the scheduler. The runtime overhead of this option is minimal. +config SCHED_INFO + bool + default n + config SCHEDSTATS bool "Collect scheduler statistics" depends on DEBUG_KERNEL && PROC_FS + select SCHED_INFO help If you say Y here, additional code will be inserted into the scheduler and related routines to collect statistics about
tip-bot for Naveen N. Rao
merge bot[tip:sched/urgent] sched/stat: Simplify the sched_info accounting dependency
In reply to Naveen N. Raosched/stat: Simplify the sched_info accounting dependency
Commit-ID: f6db8347993256b58bd4746b0c4c5b935c32210d Gitweb: http://git.kernel.org/tip/f6db8347993256b58bd4746b0c4c5b935c32210d Author: Naveen N. Rao <[email protected]> AuthorDate: Thu, 25 Jun 2015 23:53:37 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 4 Jul 2015 10:04:30 +0200
sched/stat: Simplify the sched_info accounting dependency
Both CONFIG_SCHEDSTATS=y and CONFIG_TASK_DELAY_ACCT=y track task sched_info, which results in ugly #if clauses.
Simplify the code by introducing a synthethic CONFIG_SCHED_INFO switch, selected by both.
--- include/linux/sched.h | 6 +++--- init/Kconfig | 1 + kernel/sched/core.c | 2 +- kernel/sched/stats.h | 4 ++-- lib/Kconfig.debug | 5 +++++ 5 files changed, 12 insertions(+), 6 deletions(-)
include/linux/sched.h +3 -3
@@ -849,7 +849,7 @@ extern struct user_struct root_user;struct backing_dev_info ;struct reclaim_state ; -#if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) +#ifdef CONFIG_SCHED_INFO struct sched_info { /* cumulative counters */ unsigned long pcount; /* # of times run on this cpu */
@@ -859,7 +859,7 @@ struct sched_info {unsigned long long last_arrival,/* when we last ran on a cpu */ last_queued;/* when we were last queued to run */ }; -#endif /* defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT) */ +#endif /* CONFIG_SCHED_INFO */ #ifdef CONFIG_TASK_DELAY_ACCT struct task_delay_info {
@@ -1408,7 +1408,7 @@ struct task_struct {int rcu_tasks_idle_cpu;#endif /* #ifdef CONFIG_TASKS_RCU */ -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO struct sched_info sched_info;#endif
init/Kconfig +1 -0
@@ -435,6 +435,7 @@ config TASKSTATS config TASK_DELAY_ACCT bool "Enable per-task delay accounting" depends on TASKSTATS + select SCHED_INFO help Collect information on time spent by a task waiting for system resources like cpu, synchronous block I/O completion and swapping
kernel/sched/core.c +1 -1
@@ -1975,7 +1975,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)set_task_cpu (p, cpu);raw_spin_unlock_irqrestore (&p->pi_lock, flags); -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO if (likely (sched_info_on ()))memset (&p->sched_info,0 ,sizeof (p->sched_info));#endif
kernel/sched/stats.h +2 -2
@@ -47,7 +47,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)# define schedstat_set (var, val) do { } while (0)#endif -#if defined(CONFIG_SCHEDSTATS ) || defined(CONFIG_TASK_DELAY_ACCT ) +#ifdef CONFIG_SCHED_INFO static inline void sched_info_reset_dequeued (struct task_struct *t) { t->sched_info.last_queued =0 ;
@@ -156,7 +156,7 @@ sched_info_switch(struct rq *rq,#define sched_info_depart (rq, t) do { } while (0)#define sched_info_arrive (rq, next) do { } while (0)#define sched_info_switch (rq, t, next) do { } while (0) -#endif /* CONFIG_SCHEDSTATS || CONFIG_TASK_DELAY_ACCT */ +#endif /* CONFIG_SCHED_INFO */ /* * The following are functions that support scheduler-internal time accounting.
lib/Kconfig.debug +5 -0
@@ -841,9 +841,14 @@ config SCHED_DEBUG that can help debug the scheduler. The runtime overhead of this option is minimal. +config SCHED_INFO + bool + default n + config SCHEDSTATS bool "Collect scheduler statistics" depends on DEBUG_KERNEL && PROC_FS + select SCHED_INFO help If you say Y here, additional code will be inserted into the scheduler and related routines to collect statistics about
PATCH v2 2/2 schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
In reply to Naveen N. RaoIn the unlikely scenario that the kernel is booted with nodelayacct, we dump all zeroes so as to make it clear that scheduler statistics are not available.
--- fs/proc/base.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/proc/base.c +7 -4
@@ -304,14 +304,17 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, }#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO /* * Provides /proc/PID/schedstat */ static int proc_pid_schedstat (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task) { -seq_printf (m,"%llu %llu %lu\n" , +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else +seq_printf (m,"%llu %lld %ld\n" , (unsigned long long )task->se.sum_exec_runtime, (unsigned long long )task->sched_info.run_delay, task->sched_info.pcount);
@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
Signature · 1 line
2.4.0
Re: [PATCH v2 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
fs/proc/base.c static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, · line 317
Quoted 11 lines · Naveen N. Rao
/*
* Provides/proc/PID/schedstat
*/
static int proc_pid_schedstat(structseq_file*m, structpid_namespace*ns,fs/proc/base.c +4
-1struct pid *pid, struct task_struct *task) { - seq_printf(m, "%llu %llu %lu\n", +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else + seq_printf(m, "%llu %lld %ld\n",
Should the above be seq_printf(m, "%llu %llu %lu\n", ?
Quoted 6 lines
fs/proc/base.c +0
-0(unsigned long long )task->se.sum_exec_runtime, (unsigned long long )task->sched_info.run_delay, task->sched_info.pcount);Signature · 1 line
2.4.0
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
Re: [PATCH v2 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
Quoted 15 lines · Srikar Dronamraju
fs/proc/base.c static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, · line 317
Quoted 11 lines · Naveen N. Rao
/*
* Provides/proc/PID/schedstat
*/
static int proc_pid_schedstat(structseq_file*m, structpid_namespace*ns,fs/proc/base.c +4
-1struct pid *pid, struct task_struct *task) { - seq_printf(m, "%llu %llu %lu\n", +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else + seq_printf(m, "%llu %lld %ld\n",Should the above be seq_printf(m, "%llu %llu %lu\n", ?
Yikes! Nice catch, thanks! This looks to be left over from my tests with returning -1. Fixed patch on the way...
Regards,
Naveen
PATCH v3 2/2 schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
In reply to Srikar DronamrajuIn the unlikely scenario that the kernel is booted with nodelayacct, we dump all zeroes so as to make it clear that scheduler statistics are not available.
---
Changes since v2: Revert to unsigned long in printf
fs/proc/base.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/proc/base.c +7 -4
@@ -304,14 +304,17 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, }#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO /* * Provides /proc/PID/schedstat */ static int proc_pid_schedstat (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task) { -seq_printf (m,"%llu %llu %lu\n" , +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else +seq_printf (m,"%llu %llu %lu\n" , (unsigned long long )task->se.sum_exec_runtime, (unsigned long long )task->sched_info.run_delay, task->sched_info.pcount);
@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
Signature · 1 line
2.4.0
Re: [PATCH v3 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
Quoted 8 lines · Naveen N. Rao
In the unlikely scenario that the kernel is booted with nodelayacct, we dump all zeroes so as to make it clear that scheduler statistics are not available.
Signed-off-by Naveen N. Rao <[email protected]>---
Changes since v2: Revert to unsigned long in printf
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
Balbir Singh
Acked-byRe: [PATCH v3 2/2] schedstat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO is set
Quoted 6 lines · Srikar Dronamraju
Quoted 4 lines · Naveen N. Rao
In the unlikely scenario that the kernel is booted with nodelayacct, we dump all zeroes so as to make it clear that scheduler statistics are not available.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Naveen N. Rao <[email protected]>---
Changes since v2: Revert to unsigned long in printfLooks good to me.
tip-bot for Naveen N. Rao
merge bot[tip:sched/urgent] sched/stat: Expose /proc/pid/ schedstat if CONFIG_SCHED_INFO=y
In reply to Naveen N. Raosched/stat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO=y
Commit-ID: 74ed568374f0e74d80a63ab5496bf32db641ec60 Gitweb: http://git.kernel.org/tip/74ed568374f0e74d80a63ab5496bf32db641ec60 Author: Naveen N. Rao <[email protected]> AuthorDate: Tue, 30 Jun 2015 14:36:03 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2015 10:02:58 +0200
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.
--- fs/proc/base.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/proc/base.c +7 -4
@@ -304,14 +304,17 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, }#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO /* * Provides /proc/PID/schedstat */ static int proc_pid_schedstat (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task) { -seq_printf (m,"%llu %llu %lu\n" , +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else +seq_printf (m,"%llu %llu %lu\n" , (unsigned long long )task->se.sum_exec_runtime, (unsigned long long )task->sched_info.run_delay, task->sched_info.pcount);
@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
tip-bot for Naveen N. Rao
merge bot[tip:sched/urgent] sched/stat: Expose /proc/pid/ schedstat if CONFIG_SCHED_INFO=y
In reply to Naveen N. Raosched/stat: Expose /proc/pid/schedstat if CONFIG_SCHED_INFO=y
Commit-ID: 5968cecedd7a09f23e9fcb5f9fb4e893712f35ba Gitweb: http://git.kernel.org/tip/5968cecedd7a09f23e9fcb5f9fb4e893712f35ba Author: Naveen N. Rao <[email protected]> AuthorDate: Tue, 30 Jun 2015 14:36:03 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 4 Jul 2015 10:04:31 +0200
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.
--- fs/proc/base.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/proc/base.c +7 -4
@@ -304,14 +304,17 @@ static int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, }#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO /* * Provides /proc/PID/schedstat */ static int proc_pid_schedstat (struct seq_file *m,struct pid_namespace *ns,struct pid *pid,struct task_struct *task) { -seq_printf (m,"%llu %llu %lu\n" , +if (unlikely (!sched_info_on ())) +seq_printf (m,"0 0 0\n" ); +else +seq_printf (m,"%llu %llu %lu\n" , (unsigned long long )task->se.sum_exec_runtime, (unsigned long long )task->sched_info.run_delay, task->sched_info.pcount);
@@ -2600,7 +2603,7 @@ static const struct pid_entry tgid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP
@@ -2948,7 +2951,7 @@ static const struct pid_entry tid_base_stuff[] = {#ifdef CONFIG_STACKTRACE ONE("stack", S_IRUSR, proc_pid_stack),#endif -#ifdef CONFIG_SCHEDSTATS +#ifdef CONFIG_SCHED_INFO ONE ("schedstat" ,S_IRUGO , proc_pid_schedstat), #endif #ifdef CONFIG_LATENCYTOP