* [PATCH 1/2] cpufreq: conservative: fix requested_freq reduction issue
@ 2013-11-08 5:23 Xiaoguang Chen
2013-11-08 5:23 ` [PATCH 2/2] cpufreq: conservative: set requested_freq to policy max when it is over policy max Xiaoguang Chen
0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Chen @ 2013-11-08 5:23 UTC (permalink / raw)
To: rjw, viresh.kumar, cpufreq, linux-pm, linux-kernel; +Cc: chenxg, chenxg.marvell
When decreasing frequency, requested_freq may be less than
freq_target, So requested_freq minus freq_target may be negative,
But reqested_freq's unit is unsigned int, then the negative result
will be one larger integer which may be even higher than
requested_freq.
This patch is to fix such issue. when result becomes negative,
set requested_freq as the min value of policy.
Signed-off-by: Xiaoguang Chen <chenxg@marvell.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/cpufreq_conservative.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index f62d822..218460f 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -80,13 +80,18 @@ static void cs_check_cpu(int cpu, unsigned int load)
/* Check for frequency decrease */
if (load < cs_tuners->down_threshold) {
+ unsigned int freq_target;
/*
* if we cannot reduce the frequency anymore, break out early
*/
if (policy->cur == policy->min)
return;
- dbs_info->requested_freq -= get_freq_target(cs_tuners, policy);
+ freq_target = get_freq_target(cs_tuners, policy);
+ if (dbs_info->requested_freq > freq_target)
+ dbs_info->requested_freq -= freq_target;
+ else
+ dbs_info->requested_freq = policy->min;
__cpufreq_driver_target(policy, dbs_info->requested_freq,
CPUFREQ_RELATION_L);
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] cpufreq: conservative: set requested_freq to policy max when it is over policy max
2013-11-08 5:23 [PATCH 1/2] cpufreq: conservative: fix requested_freq reduction issue Xiaoguang Chen
@ 2013-11-08 5:23 ` Xiaoguang Chen
2013-11-08 5:27 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Xiaoguang Chen @ 2013-11-08 5:23 UTC (permalink / raw)
To: rjw, viresh.kumar, cpufreq, linux-pm, linux-kernel; +Cc: chenxg, chenxg.marvell
When requested_freq is over policy->max, set it to policy->max.
This can help to speed up decreasing frequency.
Signed-off-by: Xiaoguang Chen <chenxg@marvell.com>
---
drivers/cpufreq/cpufreq_conservative.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 218460f..25a70d0 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load)
dbs_info->requested_freq += get_freq_target(cs_tuners, policy);
+ if (dbs_info->requested_freq > policy->max)
+ dbs_info->requested_freq = policy->max;
+
__cpufreq_driver_target(policy, dbs_info->requested_freq,
CPUFREQ_RELATION_H);
return;
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] cpufreq: conservative: set requested_freq to policy max when it is over policy max
2013-11-08 5:23 ` [PATCH 2/2] cpufreq: conservative: set requested_freq to policy max when it is over policy max Xiaoguang Chen
@ 2013-11-08 5:27 ` Viresh Kumar
0 siblings, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2013-11-08 5:27 UTC (permalink / raw)
To: Xiaoguang Chen
Cc: Rafael J. Wysocki, cpufreq@vger.kernel.org,
linux-pm@vger.kernel.org, Linux Kernel Mailing List,
Xiaoguang Chen
On 8 November 2013 10:53, Xiaoguang Chen <chenxg@marvell.com> wrote:
> When requested_freq is over policy->max, set it to policy->max.
> This can help to speed up decreasing frequency.
>
> Signed-off-by: Xiaoguang Chen <chenxg@marvell.com>
> ---
> drivers/cpufreq/cpufreq_conservative.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
> index 218460f..25a70d0 100644
> --- a/drivers/cpufreq/cpufreq_conservative.c
> +++ b/drivers/cpufreq/cpufreq_conservative.c
> @@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load)
>
> dbs_info->requested_freq += get_freq_target(cs_tuners, policy);
>
> + if (dbs_info->requested_freq > policy->max)
> + dbs_info->requested_freq = policy->max;
> +
> __cpufreq_driver_target(policy, dbs_info->requested_freq,
> CPUFREQ_RELATION_H);
> return;
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-08 5:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08 5:23 [PATCH 1/2] cpufreq: conservative: fix requested_freq reduction issue Xiaoguang Chen
2013-11-08 5:23 ` [PATCH 2/2] cpufreq: conservative: set requested_freq to policy max when it is over policy max Xiaoguang Chen
2013-11-08 5:27 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).