From ede6f9eb44b43b3d26b348325bf650764963af15 Mon Sep 17 00:00:00 2001 From: Daeyeong Lee Date: Tue, 13 Mar 2018 13:00:46 +0900 Subject: [PATCH] [COMMON] sched: ehmp: Add trace log of ontime_task_wakeup Change-Id: I71ae8e7e8dab77f9771808676c1a14fe79a4c6e7 Signed-off-by: Daeyeong Lee --- include/trace/events/ehmp.h | 27 +++++++++++++++++++++++++++ kernel/sched/ehmp.c | 16 +++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/include/trace/events/ehmp.h b/include/trace/events/ehmp.h index 9667bd8f4042..6c9878a9524e 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_ontime_task_wakeup, + + TP_PROTO(struct task_struct *tsk, int src_cpu, int dst_cpu, char *label), + + TP_ARGS(tsk, src_cpu, dst_cpu, label), + + TP_STRUCT__entry( + __array( char, comm, TASK_COMM_LEN ) + __field( pid_t, pid ) + __field( int, src_cpu ) + __field( int, dst_cpu ) + __array( char, label, 64 ) + ), + + TP_fast_assign( + memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN); + __entry->pid = tsk->pid; + __entry->src_cpu = src_cpu; + __entry->dst_cpu = dst_cpu; + strncpy(__entry->label, label, 64); + ), + + TP_printk("comm=%s pid=%d src_cpu=%d dst_cpu=%d reason=%s", + __entry->comm, __entry->pid, __entry->src_cpu, + __entry->dst_cpu, __entry->label) +); + TRACE_EVENT(ehmp_lbt_overutilized, TP_PROTO(int cpu, int level, unsigned long util, unsigned long capacity, bool overutilized), diff --git a/kernel/sched/ehmp.c b/kernel/sched/ehmp.c index 8a96bf87adbd..7b53da91c6d6 100644 --- a/kernel/sched/ehmp.c +++ b/kernel/sched/ehmp.c @@ -1451,8 +1451,11 @@ static int ontime_task_wakeup(struct task_struct *p) target_cpu = ontime_select_target_cpu(&target_mask, tsk_cpus_allowed(p)); - if (cpu_selected(target_cpu)) + if (cpu_selected(target_cpu)) { + trace_ehmp_ontime_task_wakeup(p, task_cpu(p), + target_cpu, "up ontime"); goto ontime_up; + } } /* @@ -1471,8 +1474,11 @@ static int ontime_task_wakeup(struct task_struct *p) delta = delta >> 10; if (delta > get_min_residency(ontime_task_cpu(p)) && - ontime_load_avg(p) < get_down_threshold(ontime_task_cpu(p))) + ontime_load_avg(p) < get_down_threshold(ontime_task_cpu(p))) { + trace_ehmp_ontime_task_wakeup(p, task_cpu(p), -1, + "release ontime"); goto ontime_out; + } /* * If there is a possible cpu to stay ontime, task will wake up at this cpu. @@ -1480,9 +1486,13 @@ static int ontime_task_wakeup(struct task_struct *p) cpumask_copy(&target_mask, cpu_coregroup_mask(ontime_task_cpu(p))); target_cpu = ontime_select_target_cpu(&target_mask, tsk_cpus_allowed(p)); - if (cpu_selected(target_cpu)) + if (cpu_selected(target_cpu)) { + trace_ehmp_ontime_task_wakeup(p, task_cpu(p), + target_cpu, "stay ontime"); goto ontime_stay; + } + trace_ehmp_ontime_task_wakeup(p, task_cpu(p), -1, "banished"); goto ontime_out; } -- 2.20.1