From 00016bf707caf91dce858a1840eab20624399db4 Mon Sep 17 00:00:00 2001 From: Daeyeong Lee Date: Tue, 13 Mar 2018 19:13:41 +0900 Subject: [PATCH] [COMMON] sched: ehmp: Add trace log of lbt_overutilized Change-Id: I6b6e1ef69679de27b14eee7c8629e760a1fe8c98 Signed-off-by: Daeyeong Lee --- include/trace/events/ehmp.h | 27 +++++++++++++++++++++++++++ kernel/sched/ehmp.c | 9 ++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/include/trace/events/ehmp.h b/include/trace/events/ehmp.h index cd99ba3e93e3..9667bd8f4042 100644 --- a/include/trace/events/ehmp.h +++ b/include/trace/events/ehmp.h @@ -334,6 +334,33 @@ TRACE_EVENT(ehmp_ontime_check_migrate, __entry->migrate, __entry->label) ); +TRACE_EVENT(ehmp_lbt_overutilized, + + TP_PROTO(int cpu, int level, unsigned long util, unsigned long capacity, bool overutilized), + + TP_ARGS(cpu, level, util, capacity, overutilized), + + TP_STRUCT__entry( + __field( int, cpu ) + __field( int, level ) + __field( unsigned long, util ) + __field( unsigned long, capacity ) + __field( bool, overutilized ) + ), + + TP_fast_assign( + __entry->cpu = cpu; + __entry->level = level; + __entry->util = util; + __entry->capacity = capacity; + __entry->overutilized = overutilized; + ), + + TP_printk("cpu=%d level=%d util=%lu capacity=%lu overutilized=%d", + __entry->cpu, __entry->level, __entry->util, + __entry->capacity, __entry->overutilized) +); + #endif /* _TRACE_EHMP_H */ /* This part must be outside protection */ diff --git a/kernel/sched/ehmp.c b/kernel/sched/ehmp.c index b6299942e6df..0dffdb63a085 100644 --- a/kernel/sched/ehmp.c +++ b/kernel/sched/ehmp.c @@ -339,11 +339,18 @@ static inline int get_last_level(struct lbt_overutil *ou) bool lbt_overutilized(int cpu, int level) { struct lbt_overutil *ou = per_cpu(lbt_overutil, cpu); + bool overutilized; if (!ou) return false; - return cpu_util(cpu) > ou[level].capacity; + overutilized = (cpu_util(cpu) > ou[level].capacity) ? true : false; + + if (overutilized) + trace_ehmp_lbt_overutilized(cpu, level, cpu_util(cpu), + ou[level].capacity, overutilized); + + return overutilized; } void update_lbt_overutil(int cpu, unsigned long capacity) -- 2.20.1