Re: [RFC PATCH 2/5] sched/events: Introduce cfs_rq load tracking trace event

From: Steven Rostedt
Date: Tue Mar 28 2017 - 13:36:40 EST


On Tue, 28 Mar 2017 18:44:59 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Tue, Mar 28, 2017 at 10:46:00AM -0400, Steven Rostedt wrote:
> > On Tue, 28 Mar 2017 07:35:38 +0100
> > Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
> >
> > > /* This part must be outside protection */
> > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > > index 03adf9fb48b1..ac19ab6ced8f 100644
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -2950,6 +2950,9 @@ __update_load_avg(u64 now, int cpu, struct sched_avg *sa,
> > > sa->util_avg = sa->util_sum / LOAD_AVG_MAX;
> > > }
> > >
> > > + if (cfs_rq)
> > > + trace_sched_load_cfs_rq(cfs_rq);
> > > +
> >
> > Please use TRACE_EVENT_CONDITION(), and test for cfs_rq not NULL.
>
> I too suggested that; but then I looked again at that code and we can
> actually do this. cfs_rq can be constant propagated and the if
> determined at build time.
>
> Its not immediately obvious from the current code; but if we do
> something like the below, it should be clearer.
>

But why play games, and rely on the design of the code? A
TRACE_EVENT_CONDTION() is more robust and documents that this
tracepoint should not be called when cfs_rq is NULL.

-- Steve