summaryrefslogtreecommitdiff
path: root/kernel/sched/sched.h
diff options
context:
space:
mode:
authorJoonwoo Park <joonwoop@codeaurora.org>2016-05-17 20:04:54 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-20 19:23:47 -0700
commitd9ff0d77afb3e5b79973b402f9a65bafa7d0cbd6 (patch)
treebdb0465b2e5ad2b01db6a2e1e80e21d1698551c6 /kernel/sched/sched.h
parent167eebb0155f65077a1e5d57e3fb069fe9e6be70 (diff)
sched: simplify CPU frequency estimation and cycle counter API
Most of CPUs increase cycle counter by one every cycle which makes frequency = cycles / time_delta is correct. Therefore it's reasonable to get rid of current cpu_cycle_max_scale_factor and ask cycle counter read callback function to return scaled counter value when it's needed in such a case that cycle counter doesn't increase every cycle. Thus multiply NSEC_PER_SEC / HZ_PER_KHZ to CPU cycle counter delta as we calculate frequency in khz and remove cpu_cycle_max_scale_factor. This allows us to simplify frequency estimation and cycle counter API. Change-Id: Ie7a628d4bc77c9b6c769f6099ce8d75740262a14 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'kernel/sched/sched.h')
-rw-r--r--kernel/sched/sched.h12
1 files changed, 1 insertions, 11 deletions
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 96f5c187dfcd..a66d8a12051c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -389,11 +389,6 @@ struct sched_cluster {
*/
unsigned int cur_freq, max_freq, max_mitigated_freq, min_freq;
unsigned int max_possible_freq;
- /*
- * cpu_cycle_max_scale_factor represents number of cycles per NSEC at
- * CPU's fmax.
- */
- u32 cpu_cycle_max_scale_factor;
bool freq_init_done;
int dstate, dstate_wakeup_latency, dstate_wakeup_energy;
unsigned int static_cluster_pwr_cost;
@@ -1137,14 +1132,9 @@ static inline int cpu_max_power_cost(int cpu)
return cpu_rq(cpu)->cluster->max_power_cost;
}
-static inline int cpu_cycle_max_scale_factor(int cpu)
-{
- return cpu_rq(cpu)->cluster->cpu_cycle_max_scale_factor;
-}
-
static inline u32 cpu_cycles_to_freq(int cpu, u64 cycles, u32 period)
{
- return div64_u64(cycles * cpu_cycle_max_scale_factor(cpu), period);
+ return div64_u64(cycles, period);
}
static inline bool hmp_capable(void)