* [PATCH] cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold
@ 2013-02-05 21:04 Stratos Karafotis
2013-02-06 5:35 ` Viresh Kumar
0 siblings, 1 reply; 3+ messages in thread
From: Stratos Karafotis @ 2013-02-05 21:04 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: cpufreq, linux-pm, linux-kernel
In order to avoid the calculation of up_threshold - down_differential
every time that the frequency must be decreased, we replace the
down_differential tuner with the adj_up_threshold which keeps the
difference across multiple checks.
Update the adj_up_threshold only when the up_theshold is also updated.
Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
---
drivers/cpufreq/cpufreq_governor.h | 2 +-
drivers/cpufreq/cpufreq_ondemand.c | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index f661654..4250944 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -108,7 +108,7 @@ struct od_dbs_tuners {
unsigned int sampling_rate;
unsigned int sampling_down_factor;
unsigned int up_threshold;
- unsigned int down_differential;
+ unsigned int adj_up_threshold;
unsigned int powersave_bias;
unsigned int io_is_busy;
};
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 7731f7c..2cc76ad 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -47,7 +47,8 @@ static struct cpufreq_governor cpufreq_gov_ondemand;
static struct od_dbs_tuners od_tuners = {
.up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
.sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
- .down_differential = DEF_FREQUENCY_DOWN_DIFFERENTIAL,
+ .adj_up_threshold = DEF_FREQUENCY_UP_THRESHOLD -
+ DEF_FREQUENCY_DOWN_DIFFERENTIAL,
.ignore_nice = 0,
.powersave_bias = 0,
};
@@ -192,11 +193,9 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
* support the current CPU usage without triggering the up policy. To be
* safe, we focus 10 points under the threshold.
*/
- if (load_freq < (od_tuners.up_threshold - od_tuners.down_differential) *
- policy->cur) {
+ if (load_freq < od_tuners.adj_up_threshold * policy->cur) {
unsigned int freq_next;
- freq_next = load_freq / (od_tuners.up_threshold -
- od_tuners.down_differential);
+ freq_next = load_freq / od_tuners.adj_up_threshold;
/* No longer fully busy, reset rate_mult */
dbs_info->rate_mult = 1;
@@ -351,6 +350,10 @@ static ssize_t store_up_threshold(struct kobject *a, struct attribute *b,
input < MIN_FREQUENCY_UP_THRESHOLD) {
return -EINVAL;
}
+ /* Calculate the new adj_up_threshold */
+ od_tuners.adj_up_threshold += input;
+ od_tuners.adj_up_threshold -= od_tuners.up_threshold;
+
od_tuners.up_threshold = input;
return count;
}
@@ -507,7 +510,8 @@ static int __init cpufreq_gov_dbs_init(void)
if (idle_time != -1ULL) {
/* Idle micro accounting is supported. Use finer thresholds */
od_tuners.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD;
- od_tuners.down_differential = MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
+ od_tuners.adj_up_threshold = MICRO_FREQUENCY_UP_THRESHOLD -
+ MICRO_FREQUENCY_DOWN_DIFFERENTIAL;
/*
* In nohz/micro accounting case we set the minimum frequency
* not depending on HZ, but fixed (very low). The deferred
--
1.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold
2013-02-05 21:04 [PATCH] cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold Stratos Karafotis
@ 2013-02-06 5:35 ` Viresh Kumar
2013-02-06 12:58 ` Rafael J. Wysocki
0 siblings, 1 reply; 3+ messages in thread
From: Viresh Kumar @ 2013-02-06 5:35 UTC (permalink / raw)
To: Stratos Karafotis; +Cc: Rafael J. Wysocki, cpufreq, linux-pm, linux-kernel
On Wed, Feb 6, 2013 at 2:34 AM, Stratos Karafotis <stratosk@semaphore.gr> wrote:
> In order to avoid the calculation of up_threshold - down_differential
> every time that the frequency must be decreased, we replace the
> down_differential tuner with the adj_up_threshold which keeps the
> difference across multiple checks.
>
> Update the adj_up_threshold only when the up_theshold is also updated.
>
> Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> ---
> drivers/cpufreq/cpufreq_governor.h | 2 +-
> drivers/cpufreq/cpufreq_ondemand.c | 16 ++++++++++------
> 2 files changed, 11 insertions(+), 7 deletions(-)
Makes sense.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold
2013-02-06 5:35 ` Viresh Kumar
@ 2013-02-06 12:58 ` Rafael J. Wysocki
0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2013-02-06 12:58 UTC (permalink / raw)
To: Viresh Kumar; +Cc: Stratos Karafotis, cpufreq, linux-pm, linux-kernel
On Wednesday, February 06, 2013 11:05:45 AM Viresh Kumar wrote:
> On Wed, Feb 6, 2013 at 2:34 AM, Stratos Karafotis <stratosk@semaphore.gr> wrote:
> > In order to avoid the calculation of up_threshold - down_differential
> > every time that the frequency must be decreased, we replace the
> > down_differential tuner with the adj_up_threshold which keeps the
> > difference across multiple checks.
> >
> > Update the adj_up_threshold only when the up_theshold is also updated.
> >
> > Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
> > ---
> > drivers/cpufreq/cpufreq_governor.h | 2 +-
> > drivers/cpufreq/cpufreq_ondemand.c | 16 ++++++++++------
> > 2 files changed, 11 insertions(+), 7 deletions(-)
>
> Makes sense.
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Thanks, applied to bleeding-edge.
Rafael
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-06 12:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-05 21:04 [PATCH] cpufreq: ondemand: Replace down_differential tuner with adj_up_threshold Stratos Karafotis
2013-02-06 5:35 ` Viresh Kumar
2013-02-06 12:58 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.