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

From: Steven Rostedt
Date: Tue Mar 28 2017 - 10:46:09 EST


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.

That way it moves the if (cfs_rq) out of the scheduler code and into
the jump label protected location. That is, the if is only tested when
tracing is enabled.

-- Steve


> return decayed;
> }
>
> @@ -3170,6 +3173,8 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
> update_tg_cfs_util(cfs_rq, se);
> update_tg_cfs_load(cfs_rq, se);
>
> + trace_sched_load_cfs_rq(cfs_rq);
> +
> return 1;
> }
>
> @@ -3359,6 +3364,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
> set_tg_cfs_propagate(cfs_rq);
>
> cfs_rq_util_change(cfs_rq);
> +
> + trace_sched_load_cfs_rq(cfs_rq);
> }
>
> /**
> @@ -3379,6 +3386,8 @@ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
> set_tg_cfs_propagate(cfs_rq);
>
> cfs_rq_util_change(cfs_rq);
> +
> + trace_sched_load_cfs_rq(cfs_rq);
> }
>
> /* Add the load generated by se into cfs_rq's load average */