[COMMON] sched: ehmp: Add trace log of ontime_task_wakeup
authorDaeyeong Lee <daeyeong.lee@samsung.com>
Tue, 13 Mar 2018 04:00:46 +0000 (13:00 +0900)
committerChungwoo Park <cww.park@samsung.com>
Mon, 21 May 2018 08:33:03 +0000 (17:33 +0900)
Change-Id: I71ae8e7e8dab77f9771808676c1a14fe79a4c6e7
Signed-off-by: Daeyeong Lee <daeyeong.lee@samsung.com>
include/trace/events/ehmp.h
kernel/sched/ehmp.c

index 9667bd8f4042b9bfe31fec3f686ee2f3ffdedaa4..6c9878a9524ea9f4d954a2d1d825662f346a8a4b 100644 (file)
@@ -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),
index 8a96bf87adbdd0ac371756d367aee81bc46d20af..7b53da91c6d6b9d578826e4ddc0e2215cac5a218 100644 (file)
@@ -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;
        }