diff options
author | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2016-07-28 11:22:08 -0700 |
---|---|---|
committer | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2016-08-22 11:33:55 -0700 |
commit | e2b9b4a39560077bf20712564a8de920431f1c62 (patch) | |
tree | ca38c4c6c11ba659736dbcf99959d1ca7ce06a9f /kernel/sched | |
parent | e97839440656ab1cae408d36cda646221165c934 (diff) |
sched: Move CPU cstate tracking under CONFIG_SCHED_HMP
While tracking C-states makes sense under CONFIG_SMP as well, cstate
information is currently unused under CONFIG_SMP. Move it under
CONFIG_SCHED_HMP for now since that is the only place it is relevant
at the moment.
Change-Id: Ifc5812cfe14ebf2b4d447100dcd87f02ab29ff7a
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 41 | ||||
-rw-r--r-- | kernel/sched/sched.h | 2 |
2 files changed, 22 insertions, 21 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b599a01c4f53..82a2fe73345e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -774,24 +774,6 @@ void sched_avg_update(struct rq *rq) } } -/* - * Note C-state for (idle) cpus. - * - * @cstate = cstate index, 0 -> active state - * @wakeup_energy = energy spent in waking up cpu - * @wakeup_latency = latency to wakeup from cstate - * - */ -void -sched_set_cpu_cstate(int cpu, int cstate, int wakeup_energy, int wakeup_latency) -{ - struct rq *rq = cpu_rq(cpu); - - rq->cstate = cstate; /* C1, C2 etc */ - rq->wakeup_energy = wakeup_energy; - rq->wakeup_latency = wakeup_latency; -} - #endif /* CONFIG_SMP */ #ifdef CONFIG_SCHED_HMP @@ -851,6 +833,24 @@ static inline void set_task_last_switch_out(struct task_struct *p, } /* + * Note C-state for (idle) cpus. + * + * @cstate = cstate index, 0 -> active state + * @wakeup_energy = energy spent in waking up cpu + * @wakeup_latency = latency to wakeup from cstate + * + */ +void +sched_set_cpu_cstate(int cpu, int cstate, int wakeup_energy, int wakeup_latency) +{ + struct rq *rq = cpu_rq(cpu); + + rq->cstate = cstate; /* C1, C2 etc */ + rq->wakeup_energy = wakeup_energy; + rq->wakeup_latency = wakeup_latency; +} + +/* * Note D-state for (idle) cluster. * * @dstate = dstate index, 0 -> active state @@ -10941,6 +10941,9 @@ void __init sched_init(void) rq->static_cpu_pwr_cost = 0; rq->cc.cycles = SCHED_MIN_FREQ; rq->cc.time = 1; + rq->cstate = 0; + rq->wakeup_latency = 0; + rq->wakeup_energy = 0; /* * All cpus part of same cluster by default. This avoids the @@ -10959,8 +10962,6 @@ void __init sched_init(void) #endif #endif rq->max_idle_balance_cost = sysctl_sched_migration_cost; - rq->cstate = 0; - rq->wakeup_latency = 0; INIT_LIST_HEAD(&rq->cfs_tasks); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 28e2cb22e313..b45c88735ea6 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -735,7 +735,6 @@ struct rq { u64 age_stamp; u64 idle_stamp; u64 avg_idle; - int cstate, wakeup_latency, wakeup_energy; /* This is used to determine avg_idle's max value */ u64 max_idle_balance_cost; @@ -746,6 +745,7 @@ struct rq { struct cpumask freq_domain_cpumask; struct hmp_sched_stats hmp_stats; + int cstate, wakeup_latency, wakeup_energy; u64 window_start; unsigned long hmp_flags; |