Re: [PATCH v3 3/4] sched: scheduler-driven cpu frequency selection
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
Date: 2015-07-06 20:06:48
Also in:
lkml
Hi Mike, On 27/06/15 00:53, Michael Turquette wrote:
From: Michael Turquette <mturquette@baylibre.com>
[...]
quoted hunk ↗ jump to hunk
comment "CPU frequency scaling drivers" config CPUFREQ_DTdiff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 1f2c9a1..30241c9 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h@@ -494,6 +494,9 @@ extern struct cpufreq_governor cpufreq_gov_ondemand; #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE) extern struct cpufreq_governor cpufreq_gov_conservative; #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) +#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SCHED_GOV) +extern struct cpufreq_governor cpufreq_gov_sched_gov;
To get it building with CONFIG_CPU_FREQ_DEFAULT_GOV_SCHED=y . -#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SCHED_GOV) -extern struct cpufreq_governor cpufreq_gov_sched_gov; +#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SCHED) +extern struct cpufreq_governor cpufreq_gov_sched;
+#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_sched) #endif
+ +/** + * cpufreq_sched_set_capacity - interface to scheduler for changing capacity values
[...] minor nit: s/cpufreq_sched_set_capacity/cpufreq_sched_set_cap
+ * @cpu: cpu whose capacity utilization has recently changed
+ * @capacity: the new capacity requested by cpu
+ *
+ * cpufreq_sched_sched_capacity is an interface exposed to the scheduler so
+ * that the scheduler may inform the governor of updates to capacity
+ * utilization and make changes to cpu frequency. Currently this interface is
+ * designed around PELT values in CFS. It can be expanded to other scheduling
+ * classes in the future if needed.
+ *
+ * cpufreq_sched_set_capacity raises an IPI. The irq_work handler for that IPI
+ * wakes up the thread that does the actual work, cpufreq_sched_thread.
+ *
+ * This functions bails out early if either condition is true:
+ * 1) this cpu did not the new maximum capacity for its frequency domain
+ * 2) no change in cpu frequency is necessary to meet the new capacity request
+ */
+void cpufreq_sched_set_cap(int cpu, unsigned long capacity)
+{
+ unsigned int freq_new, cpu_tmp;
+ struct cpufreq_policy *policy;
+ struct gov_data *gd;
+ unsigned long capacity_max = 0;[...]