From 825b7ef93a28c91d41b370de543b111582de3982 Mon Sep 17 00:00:00 2001 From: Joonwoo Park Date: Fri, 23 Sep 2016 15:49:32 -0700 Subject: [PATCH] sched: bucketize CPU c-state levels C-state aware scheduler takes note of wakeup latency of each c-state level to determine whether to pack or wake up LPM CPU. But it doesn't distinguish small and large delta as it's inefficient for scheduler to do so on its critical path. Disregard wakeup latencies less than 64 us between different c-state levels. This reduces unnecessary task packing. CRs-fixed: 1074879 Change-Id: Ib0cadbd390d1a0b6da3e39c98010cedb43e5bf60 Signed-off-by: Joonwoo Park --- kernel/sched/hmp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/sched/hmp.c b/kernel/sched/hmp.c index a0686ea29243..3d5de8ba70a2 100644 --- a/kernel/sched/hmp.c +++ b/kernel/sched/hmp.c @@ -24,6 +24,8 @@ #include +#define CSTATE_LATENCY_GRANULARITY_SHIFT (6) + const char *task_event_names[] = {"PUT_PREV_TASK", "PICK_NEXT_TASK", "TASK_WAKE", "TASK_MIGRATE", "TASK_UPDATE", "IRQ_UPDATE"}; @@ -99,7 +101,10 @@ sched_set_cpu_cstate(int cpu, int cstate, int wakeup_energy, int wakeup_latency) rq->cstate = cstate; /* C1, C2 etc */ rq->wakeup_energy = wakeup_energy; - rq->wakeup_latency = wakeup_latency; + /* disregard small latency delta (64 us). */ + rq->wakeup_latency = ((wakeup_latency >> + CSTATE_LATENCY_GRANULARITY_SHIFT) << + CSTATE_LATENCY_GRANULARITY_SHIFT); } /*