Re: [PATCH v2 6/7] sched: Add sched_overutilized tracepoint
From: Qais Yousef
Date: Mon May 13 2019 - 08:44:07 EST
On 05/13/19 14:08, Peter Zijlstra wrote:
> On Fri, May 10, 2019 at 12:30:12PM +0100, Qais Yousef wrote:
>
> > diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> > index cbcb47972232..0cf42d13d6c4 100644
> > --- a/include/trace/events/sched.h
> > +++ b/include/trace/events/sched.h
> > @@ -600,6 +600,10 @@ DECLARE_TRACE(pelt_se,
> > TP_PROTO(int cpu, const char *path, struct sched_entity *se),
> > TP_ARGS(cpu, path, se));
> >
> > +DECLARE_TRACE(sched_overutilized,
> > + TP_PROTO(int overutilized),
> > + TP_ARGS(overutilized));
> > +
> > #endif /* _TRACE_SCHED_H */
> >
> > /* This part must be outside protection */
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 81036c34fd29..494032220fe7 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -4965,8 +4965,10 @@ static inline bool cpu_overutilized(int cpu)
> >
> > static inline void update_overutilized_status(struct rq *rq)
> > {
> > - if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu))
> > + if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) {
> > WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED);
> > + trace_sched_overutilized(1);
> > + }
> > }
> > #else
> > static inline void update_overutilized_status(struct rq *rq) { }
> > @@ -8330,8 +8332,11 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd
> >
> > /* Update over-utilization (tipping point, U >= 0) indicator */
> > WRITE_ONCE(rd->overutilized, sg_status & SG_OVERUTILIZED);
> > +
> > + trace_sched_overutilized(!!(sg_status & SG_OVERUTILIZED));
> > } else if (sg_status & SG_OVERUTILIZED) {
> > WRITE_ONCE(env->dst_rq->rd->overutilized, SG_OVERUTILIZED);
> > + trace_sched_overutilized(1);
> > }
> > }
>
> Note how the state is per root domain and the tracepoint doesn't
> communicate that.
Right! I can pass rd->span so that the probing function can use it to
differentiate the root domains if they care?
--
Qais Yousef