lkml.org 
[lkml]   [2022]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] cpufreq: Update CPU capacity reduction in store_scaling_max_freq()
Date
When the new max frequency value is stored, the task scheduler must
know about it. The scheduler uses the CPUs capacity information in the
task placement. Use the existing mechanism which provides information
about reduced CPU capacity to the scheduler due to thermal capping.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
drivers/cpufreq/cpufreq.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1f8b93f42c76..205d9ea9c023 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
+#include <linux/thermal.h>
#include <linux/tick.h>
#include <linux/units.h>
#include <trace/events/power.h>
@@ -718,6 +719,8 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf)
static ssize_t store_scaling_max_freq
(struct cpufreq_policy *policy, const char *buf, size_t count)
{
+ unsigned int frequency;
+ struct cpumask *cpus;
unsigned long val;
int ret;

@@ -726,7 +729,20 @@ static ssize_t store_scaling_max_freq
return -EINVAL;

ret = freq_qos_update_request(policy->max_freq_req, val);
- return ret >= 0 ? count : ret;
+ if (ret >= 0) {
+ /*
+ * Make sure that the task scheduler sees these CPUs
+ * capacity reduction. Use the thermal pressure mechanism
+ * to propagate this information to the scheduler.
+ */
+ cpus = policy->related_cpus;
+ frequency = __resolve_freq(policy, val, CPUFREQ_RELATION_HE);
+ arch_update_thermal_pressure(cpus, frequency);
+
+ ret = count;
+ }
+
+ return ret;
}

static ssize_t store_scaling_min_freq
--
2.17.1
\
 
 \ /
  Last update: 2022-09-30 11:49    [W:1.361 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site