Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413558 > unrolled thread
| Started by | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| First post | 2016-06-04 01:00 +0200 |
| Last post | 2016-06-08 16:30 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 1/2] sched/debug: fix /proc/sched_debug regression Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-04 01:00 +0200
Re: [PATCH v2 1/2] sched/debug: fix /proc/sched_debug regression Mel Gorman <mgorman@techsingularity.net> - 2016-06-07 15:50 +0200
Re: [PATCH v2 1/2] sched/debug: fix /proc/sched_debug regression Josh Poimboeuf <jpoimboe@redhat.com> - 2016-06-07 20:00 +0200
[tip:sched/core] sched/debug: Fix /proc/sched_debug regression tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2016-06-08 16:30 +0200
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2016-06-04 01:00 +0200 |
| Subject | [PATCH v2 1/2] sched/debug: fix /proc/sched_debug regression |
| Message-ID | <rG6el-KI-9@gated-at.bofh.it> |
Commit cb2517653fcc ("sched/debug: Make schedstats a runtime tunable
that is disabled by default") introduced a bug when CONFIG_SCHEDSTATS is
enabled and the runtime tunable is disabled (which is the default). The
wait-time, sum-exec, and sum-sleep fields are missing from the
/proc/sched_debug file in the runnable_tasks section.
Fix it with a new schedstat_val() macro which returns the field value
when schedstats is enabled and zero otherwise. The macro works with
both SCHEDSTATS and !SCHEDSTATS. I put the macro in stats.h since it
might end up being useful in other places.
Fixes: cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default")
Cc: stable@vger.kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
kernel/sched/debug.c | 15 ++++-----------
kernel/sched/stats.h | 3 +++
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index cf905f6..0368c39 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -427,19 +427,12 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
SPLIT_NS(p->se.vruntime),
(long long)(p->nvcsw + p->nivcsw),
p->prio);
-#ifdef CONFIG_SCHEDSTATS
- if (schedstat_enabled()) {
- SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
- SPLIT_NS(p->se.statistics.wait_sum),
- SPLIT_NS(p->se.sum_exec_runtime),
- SPLIT_NS(p->se.statistics.sum_sleep_runtime));
- }
-#else
+
SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
- 0LL, 0L,
+ SPLIT_NS(schedstat_val(p, se.statistics.wait_sum)),
SPLIT_NS(p->se.sum_exec_runtime),
- 0LL, 0L);
-#endif
+ SPLIT_NS(schedstat_val(p, se.statistics.sum_sleep_runtime)));
+
#ifdef CONFIG_NUMA_BALANCING
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
#endif
diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
index 70b3b6a..78955cb 100644
--- a/kernel/sched/stats.h
+++ b/kernel/sched/stats.h
@@ -33,6 +33,8 @@ rq_sched_info_dequeued(struct rq *rq, unsigned long long delta)
# define schedstat_inc(rq, field) do { if (schedstat_enabled()) { (rq)->field++; } } while (0)
# define schedstat_add(rq, field, amt) do { if (schedstat_enabled()) { (rq)->field += (amt); } } while (0)
# define schedstat_set(var, val) do { if (schedstat_enabled()) { var = (val); } } while (0)
+# define schedstat_val(rq, field) ((schedstat_enabled()) ? (rq)->field : 0)
+
#else /* !CONFIG_SCHEDSTATS */
static inline void
rq_sched_info_arrive(struct rq *rq, unsigned long long delta)
@@ -47,6 +49,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
# define schedstat_inc(rq, field) do { } while (0)
# define schedstat_add(rq, field, amt) do { } while (0)
# define schedstat_set(var, val) do { } while (0)
+# define schedstat_val(rq, field) 0
#endif
#ifdef CONFIG_SCHED_INFO
--
2.4.11
[toc] | [next] | [standalone]
| From | Mel Gorman <mgorman@techsingularity.net> |
|---|---|
| Date | 2016-06-07 15:50 +0200 |
| Message-ID | <rHpyi-3ll-47@gated-at.bofh.it> |
| In reply to | #1413558 |
On Fri, Jun 03, 2016 at 05:58:40PM -0500, Josh Poimboeuf wrote:
> Commit cb2517653fcc ("sched/debug: Make schedstats a runtime tunable
> that is disabled by default") introduced a bug when CONFIG_SCHEDSTATS is
> enabled and the runtime tunable is disabled (which is the default). The
> wait-time, sum-exec, and sum-sleep fields are missing from the
> /proc/sched_debug file in the runnable_tasks section.
>
I take it that this breaks userspace parsing?
> Fix it with a new schedstat_val() macro which returns the field value
> when schedstats is enabled and zero otherwise. The macro works with
> both SCHEDSTATS and !SCHEDSTATS. I put the macro in stats.h since it
> might end up being useful in other places.
>
> Fixes: cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default")
> Cc: stable@vger.kernel.org
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
--
Mel Gorman
SUSE Labs
[toc] | [prev] | [next] | [standalone]
| From | Josh Poimboeuf <jpoimboe@redhat.com> |
|---|---|
| Date | 2016-06-07 20:00 +0200 |
| Message-ID | <rHtse-5IE-1@gated-at.bofh.it> |
| In reply to | #1416209 |
On Tue, Jun 07, 2016 at 02:47:57PM +0100, Mel Gorman wrote:
> On Fri, Jun 03, 2016 at 05:58:40PM -0500, Josh Poimboeuf wrote:
> > Commit cb2517653fcc ("sched/debug: Make schedstats a runtime tunable
> > that is disabled by default") introduced a bug when CONFIG_SCHEDSTATS is
> > enabled and the runtime tunable is disabled (which is the default). The
> > wait-time, sum-exec, and sum-sleep fields are missing from the
> > /proc/sched_debug file in the runnable_tasks section.
> >
>
> I take it that this breaks userspace parsing?
In theory, yes, though I don't know if there are any tools out there
which parse it.
> > Fix it with a new schedstat_val() macro which returns the field value
> > when schedstats is enabled and zero otherwise. The macro works with
> > both SCHEDSTATS and !SCHEDSTATS. I put the macro in stats.h since it
> > might end up being useful in other places.
> >
> > Fixes: cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
>
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
Thanks!
--
Josh
[toc] | [prev] | [next] | [standalone]
| From | tip-bot for Josh Poimboeuf <tipbot@zytor.com> |
|---|---|
| Date | 2016-06-08 16:30 +0200 |
| Subject | [tip:sched/core] sched/debug: Fix /proc/sched_debug regression |
| Message-ID | <rHMEz-1il-59@gated-at.bofh.it> |
| In reply to | #1413558 |
Commit-ID: 9c57259117b9c25472a3fa6d5a14d6bb3b647e87
Gitweb: http://git.kernel.org/tip/9c57259117b9c25472a3fa6d5a14d6bb3b647e87
Author: Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Fri, 3 Jun 2016 17:58:40 -0500
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 8 Jun 2016 14:31:58 +0200
sched/debug: Fix /proc/sched_debug regression
Commit:
cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default")
... introduced a bug when CONFIG_SCHEDSTATS is enabled and the
runtime tunable is disabled (which is the default).
The wait-time, sum-exec, and sum-sleep fields are missing from the
/proc/sched_debug file in the runnable_tasks section.
Fix it with a new schedstat_val() macro which returns the field value
when schedstats is enabled and zero otherwise. The macro works with
both SCHEDSTATS and !SCHEDSTATS. I put the macro in stats.h since it
might end up being useful in other places.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: cb2517653fcc ("sched/debug: Make schedstats a runtime tunable that is disabled by default")
Link: http://lkml.kernel.org/r/bcda7c2790cf2ccbe586a28c02dd7b6fe7749a2b.1464994423.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/debug.c | 15 ++++-----------
kernel/sched/stats.h | 3 +++
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index cf905f6..0368c39 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -427,19 +427,12 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
SPLIT_NS(p->se.vruntime),
(long long)(p->nvcsw + p->nivcsw),
p->prio);
-#ifdef CONFIG_SCHEDSTATS
- if (schedstat_enabled()) {
- SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
- SPLIT_NS(p->se.statistics.wait_sum),
- SPLIT_NS(p->se.sum_exec_runtime),
- SPLIT_NS(p->se.statistics.sum_sleep_runtime));
- }
-#else
+
SEQ_printf(m, "%9Ld.%06ld %9Ld.%06ld %9Ld.%06ld",
- 0LL, 0L,
+ SPLIT_NS(schedstat_val(p, se.statistics.wait_sum)),
SPLIT_NS(p->se.sum_exec_runtime),
- 0LL, 0L);
-#endif
+ SPLIT_NS(schedstat_val(p, se.statistics.sum_sleep_runtime)));
+
#ifdef CONFIG_NUMA_BALANCING
SEQ_printf(m, " %d %d", task_node(p), task_numa_group_id(p));
#endif
diff --git a/kernel/sched/stats.h b/kernel/sched/stats.h
index 70b3b6a..78955cb 100644
--- a/kernel/sched/stats.h
+++ b/kernel/sched/stats.h
@@ -33,6 +33,8 @@ rq_sched_info_dequeued(struct rq *rq, unsigned long long delta)
# define schedstat_inc(rq, field) do { if (schedstat_enabled()) { (rq)->field++; } } while (0)
# define schedstat_add(rq, field, amt) do { if (schedstat_enabled()) { (rq)->field += (amt); } } while (0)
# define schedstat_set(var, val) do { if (schedstat_enabled()) { var = (val); } } while (0)
+# define schedstat_val(rq, field) ((schedstat_enabled()) ? (rq)->field : 0)
+
#else /* !CONFIG_SCHEDSTATS */
static inline void
rq_sched_info_arrive(struct rq *rq, unsigned long long delta)
@@ -47,6 +49,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
# define schedstat_inc(rq, field) do { } while (0)
# define schedstat_add(rq, field, amt) do { } while (0)
# define schedstat_set(var, val) do { } while (0)
+# define schedstat_val(rq, field) 0
#endif
#ifdef CONFIG_SCHED_INFO
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web