[PATCH RFC 5/7] sched: cfs: cpu frequency scaling arch functions

From: Mike Turquette
Date: Wed Oct 22 2014 - 02:09:29 EST


arch_eval_cpu_freq and arch_scale_cpu_freq are added to allow the
scheduler to evaluate if cpu frequency should change and to invoke that
change from a safe context.

They are weakly defined arch functions that do nothing by default. A
CPUfreq governor could use these functions to implement a frequency
scaling policy based on updates to per-task statistics or updates to
per-cpu utilization.

As discussed at Linux Plumbers Conference 2014, the goal will be to
focus on a single cpu frequency scaling policy that works for everyone.
That may mean that the weak arch functions definitions can be removed
entirely and a single policy implements that logic for all
architectures.

Not-signed-off-by: Mike Turquette <mturquette@xxxxxxxxxx>
---
kernel/sched/fair.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0930ad8..1af6f6d 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2265,6 +2265,8 @@ static u32 __compute_runnable_contrib(u64 n)
}

unsigned long arch_scale_load_capacity(int cpu);
+void arch_eval_cpu_freq(struct cpumask *cpus);
+void arch_scale_cpu_freq(void);

/*
* We can represent the historical contribution to runnable average as the
@@ -5805,6 +5807,16 @@ unsigned long __weak arch_scale_load_capacity(int cpu)
return default_scale_load_capacity(cpu);
}

+void __weak arch_eval_cpu_freq(struct cpumask *cpus)
+{
+ return;
+}
+
+void __weak arch_scale_cpu_freq(void)
+{
+ return;
+}
+
static unsigned long scale_rt_capacity(int cpu)
{
struct rq *rq = cpu_rq(cpu);
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/