diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 2b642a4c8813..947dbcae17a7 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -964,6 +964,27 @@ TRACE_EVENT(sched_boost_task, __entry->margin) ); +/* + * Tracepoint for system overutilized flag +*/ +TRACE_EVENT(sched_overutilized, + + TP_PROTO(int overutilized), + + TP_ARGS(overutilized), + + TP_STRUCT__entry( + __field( int, overutilized ) + ), + + TP_fast_assign( + __entry->overutilized = overutilized; + ), + + TP_printk("overutilized=%d", + __entry->overutilized) +); + #endif /* CONFIG_SMP */ #endif /* _TRACE_SCHED_H */ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2cea88b3ea4f..36d2f3bde904 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5134,8 +5134,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) { } @@ -8961,9 +8963,12 @@ next_group: /* 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); } + } /**