Re: [PATCH] ftrace, sched: Add TRACE_FLAG_PREEMPT_RESCHED

From: Peter Zijlstra
Date: Wed Nov 06 2013 - 11:45:35 EST


On Wed, Nov 06, 2013 at 11:37:04AM -0500, Steven Rostedt wrote:
> On Fri, 27 Sep 2013 17:29:08 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > Subject: ftrace, sched: Add TRACE_FLAG_PREEMPT_RESCHED
> > From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > 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.

This also wasn't the last version of the patch, I distinctly remember
you making me update some documentation crap.

> > +
> > + 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.

Sure whatever your code ;-), but says he who wrote:

hardsoft_irq =
(hardirq && softirq) ? 'H' :
hardirq ? 'h' :
softirq ? 's' :
'.';

Just apply the later patch and change it however you like.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/