[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131106113704.41b6ed5c@gandalf.local.home>
Date: Wed, 6 Nov 2013 11:37:04 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Yuanhan Liu <yuanhan.liu@...ux.intel.com>, mingo@...nel.org,
hpa@...or.com, linux-kernel@...r.kernel.org, tglx@...utronix.de,
linux-tip-commits@...r.kernel.org,
Fengguang Wu <fengguang.wu@...el.com>,
Huang Ying <ying.huang@...el.com>, lkp@...ux.intel.com
Subject: Re: [PATCH] ftrace, sched: Add TRACE_FLAG_PREEMPT_RESCHED
On Fri, 27 Sep 2013 17:29:08 +0200
Peter Zijlstra <peterz@...radead.org> wrote:
> Subject: ftrace, sched: Add TRACE_FLAG_PREEMPT_RESCHED
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Fri Sep 27 17:11:00 CEST 2013
>
> Since we now have two need_resched states; trace the two so we can
> observe discrepancies.
I see this is dependent on the addition of tif_need_resched() and
friends.
>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Signed-off-by: Peter Zijlstra <peterz@...radead.org>
> ---
> kernel/trace/trace.c | 3 ++-
> kernel/trace/trace.h | 1 +
> kernel/trace/trace_output.c | 13 +++++++++++--
> 3 files changed, 14 insertions(+), 3 deletions(-)
>
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1509,7 +1509,8 @@ tracing_generic_entry_update(struct trac
> #endif
> ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
> ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
> - (need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
> + (tif_need_resched() ? TRACE_FLAG_NEED_RESCHED : 0) |
> + (test_preempt_need_resched() ? TRACE_FLAG_PREEMPT_RESCHED : 0);
> }
> EXPORT_SYMBOL_GPL(tracing_generic_entry_update);
>
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -124,6 +124,7 @@ enum trace_flag_type {
> TRACE_FLAG_NEED_RESCHED = 0x04,
> TRACE_FLAG_HARDIRQ = 0x08,
> TRACE_FLAG_SOFTIRQ = 0x10,
> + TRACE_FLAG_PREEMPT_RESCHED = 0x20,
> };
>
> #define TRACE_BUF_SIZE 1024
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -618,8 +618,17 @@ int trace_print_lat_fmt(struct trace_seq
> (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' :
> (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' :
> '.';
> - need_resched =
> - (entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.';
> +
> + if ((entry->flags & TRACE_FLAG_NEED_RESCHED) &&
> + (entry->flags & TRACE_FLAG_PREEMPT_RESCHED))
> + need_resched = 'N';
> + else if (entry->flags & TRACE_FLAG_NEED_RESCHED)
> + need_resched = 'n';
> + else if (entry->flags & TRACE_FLAG_PREEMPT_RESCHED)
> + need_resched = 'p';
> + else
> + need_resched = '.';
Perhaps we should make this a switch statement?
switch (entry->flags & (TRACE_FLAG_NEED_RESCHED |
TRACE_FLAG_PREEMPT_RESCHED)) {
case TRACE_FLAG_NEED_RESCHED | TRACE_FLAG_PREEMPT_RESCHED:
need_resched = 'N';
break;
case TRACE_FLAG_NEED_RESCHED:
need_resched = 'n';
break;
case TRACE_FLAG_PREEMPT_RESCHED:
need_resched = 'p';
break;
default:
need_resched = '.';
break;
}
Simply because I find switch statements easier to read than else if
statements.
-- Steve
> +
> hardsoft_irq =
> (hardirq && softirq) ? 'H' :
> hardirq ? 'h' :
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists