Quoting Juri Lelli (2015-03-09 07:06:18)
We already have capacity information in the EAS energy model tables. Let's use it to both avoid duplication and achieve freq/uarch invariance.
Signed-off-by: Juri Lelli juri.lelli@arm.com
kernel/sched/energy_model.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/energy_model.c b/kernel/sched/energy_model.c index 7fec5af..64bd50e 100644 --- a/kernel/sched/energy_model.c +++ b/kernel/sched/energy_model.c @@ -247,6 +247,8 @@ static void em_start(struct cpufreq_policy *policy) unsigned int capacity; struct em_data *em; struct cpufreq_frequency_table *pos;
struct sched_domain *sd;
struct sched_group_energy *sge = NULL;
/* prepare per-policy private data */ em = kzalloc(sizeof(*em), GFP_KERNEL); @@ -265,16 +267,35 @@ static void em_start(struct cpufreq_policy *policy) em->up_threshold = kcalloc(count, sizeof(unsigned int), GFP_KERNEL); em->down_threshold = kcalloc(count, sizeof(unsigned int), GFP_KERNEL);
cpufreq_for_each_entry(pos, policy->freq_table) {
/* FIXME capacity below is not scaled for uarch */
capacity = pos->frequency * SCHED_CAPACITY_SCALE / policy->max;
for_each_domain(cpumask_first(policy->cpus), sd)
if (!sd->child) {
+#ifdef CONFIG_SCHED_DEBUG
pr_debug("%s: using %s sched_group_energy\n",
__func__,
sd->name);
+#endif
sge = sd->groups->sge;
break;
}
if (!sge) {
pr_debug("%s: failed to access sched_group_energy\n",
__func__);
kfree(em->up_threshold);
kfree(em->down_threshold);
kfree(em);
return;
}
for (index = 0; index < sge->nr_cap_states; index++) {
/* capacity below is both freq and uarch scaled */
capacity = sge->cap_states[index].cap;
Hi Juri,
Thanks for sharing the patch. Is there a functional change in this patch? From what I can tell this is a different way of doing the same thing. Please let me know if I am wrong.
Also, I'm trying to understand the full dependency on the energy model. I see get_cpu_usage is now used here. Assuming that we use the old code that uses the internal cpufreq frequency table (instead of the sge cap state table) then the only tangible dependency is on Vincent's V10 cpu capacity rework, correct? Put another way, you are not yet using any energy_diff stuff in the dvfs policy.
Thanks, Mike
em->up_threshold[index] = capacity * UP_THRESHOLD / 100; em->down_threshold[index] = capacity * DOWN_THRESHOLD / 100; pr_debug("%s: cpu = %u index = %d capacity = %u up = %u down = %u\n", __func__, cpumask_first(policy->cpus), index, capacity, em->up_threshold[index], em->down_threshold[index]);
index++; }
/* init per-policy kthread */ -- 2.2.2