sched: fix energy diff calculation when sync = 1

Make energy_diff() aware of sync flag and waker CPU in order to discount
energy cost of placing wakee task on the waker's CPU.

Change-Id: Ic9fa136167550307e2920fb1ea5ea340fe1b782d
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b8cab07..2956f92 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -699,9 +699,9 @@
 #ifdef CONFIG_SMP
 TRACE_EVENT(sched_cpu_util,
 
-	TP_PROTO(struct task_struct *p, int cpu, int task_util, long spare_cap, int sync),
+	TP_PROTO(struct task_struct *p, int cpu, int task_util, unsigned long curr_util, int sync),
 
-	TP_ARGS(p, cpu, task_util, spare_cap, sync),
+	TP_ARGS(p, cpu, task_util, curr_util, sync),
 
 	TP_STRUCT__entry(
 		__array(char, comm, TASK_COMM_LEN	)
@@ -712,7 +712,7 @@
 		__field(long, cpu_util			)
 		__field(unsigned int, capacity_curr		)
 		__field(unsigned int, capacity			)
-		__field(long, spare_cap				)
+		__field(unsigned long, curr_util		)
 		__field(int, sync				)
 		__field(int, idle_state				)
 	),
@@ -726,13 +726,13 @@
 		__entry->cpu_util		= cpu_util(cpu);
 		__entry->capacity_curr		= capacity_curr_of(cpu);
 		__entry->capacity		= capacity_of(cpu);
-		__entry->spare_cap		= spare_cap;
+		__entry->curr_util		= curr_util;
 		__entry->sync			= sync;
 		__entry->idle_state		= idle_get_state_idx(cpu_rq(cpu));
 	),
 
-	TP_printk("comm=%s pid=%d cpu=%d task_util=%d nr_running=%d cpu_util=%ld capacity_curr=%u capacity=%u spare_capacity=%ld sync=%d idle_state=%d",
-		__entry->comm, __entry->pid, __entry->cpu, __entry->task_util, __entry->nr_running, __entry->cpu_util, __entry->capacity_curr, __entry->capacity, __entry->spare_cap, __entry->sync, __entry->idle_state)
+	TP_printk("comm=%s pid=%d cpu=%d task_util=%d nr_running=%d cpu_util=%ld capacity_curr=%u capacity=%u curr_util=%ld sync=%d idle_state=%d",
+		__entry->comm, __entry->pid, __entry->cpu, __entry->task_util, __entry->nr_running, __entry->cpu_util, __entry->capacity_curr, __entry->capacity, __entry->curr_util, __entry->sync, __entry->idle_state)
 );
 
 DECLARE_EVENT_CLASS(sched_task_util,