cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Stratos Karafotis <stratosk@semaphore.gr>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
	linux-kernel@vger.kernel.org, cpufreq@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: ondemand: Change the calculation of target frequency
Date: Fri, 31 May 2013 14:42:09 +0200	[thread overview]
Message-ID: <2135481.eCRs7DzAb6@vostro.rjw.lan> (raw)
In-Reply-To: <CAKohpo=yFV05ON3Dth=6gLMHEVRNVb2J5+8OeLNv2G8VmSXkkQ@mail.gmail.com>

On Friday, May 31, 2013 02:24:59 PM Viresh Kumar wrote:
> On 31 May 2013 02:37, Stratos Karafotis <stratosk@semaphore.gr> wrote:
> 
> Ahh.. earlier mail got sent without me doing complete review :(
> 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > +static void od_check_cpu(int cpu, unsigned int load)
> >  {
> >         struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
> >         struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy;
> > @@ -176,29 +170,17 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
> >         dbs_info->freq_lo = 0;
> >
> >         /* Check for frequency increase */
> > -       if (load_freq > od_tuners->up_threshold * policy->cur) {
> > +       if (load > od_tuners->up_threshold) {
> 
> Chances of this getting hit are minimal now.. I don't know if keeping
> this will change anything now :)
> 
> >                 /* If switching to max speed, apply sampling_down_factor */
> >                 if (policy->cur < policy->max)
> >                         dbs_info->rate_mult =
> >                                 od_tuners->sampling_down_factor;
> >                 dbs_freq_increase(policy, policy->max);
> >                 return;
> > -       }
> > -
> > -       /* Check for frequency decrease */
> > -       /* if we cannot reduce the frequency anymore, break out early */
> > -       if (policy->cur == policy->min)
> > -               return;
> > -
> > -       /*
> > -        * The optimal frequency is the frequency that is the lowest that can
> > -        * 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->adj_up_threshold
> > -                       * policy->cur) {
> > +       } else {
> > +               /* Calculate the next frequency proportional to load */
> >                 unsigned int freq_next;
> > -               freq_next = load_freq / od_tuners->adj_up_threshold;
> > +               freq_next = load * policy->max / 100;
> 
> Rafael asked why you believe this is the right formula and I really couldn't
> find an appropriate answer to that, sorry :(

Right, it would be good to explain that.

"Proportional to load" means C * load, so why is "policy->max / 100" *the* right C?

Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

      reply	other threads:[~2013-05-31 12:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 21:07 [PATCH] cpufreq: ondemand: Change the calculation of target frequency Stratos Karafotis
2013-05-31  8:51 ` Viresh Kumar
2013-05-31 16:33   ` Stratos Karafotis
2013-06-01 12:27     ` Rafael J. Wysocki
2013-06-01 12:50       ` Stratos Karafotis
2013-06-01 14:56     ` Viresh Kumar
2013-06-01 16:06       ` Stratos Karafotis
2013-06-03  6:11         ` Viresh Kumar
2013-06-01 19:37       ` Rafael J. Wysocki
2013-06-03  6:51         ` Viresh Kumar
2013-06-03  6:55           ` Viresh Kumar
2013-06-03 10:57             ` Rafael J. Wysocki
2013-06-03 11:24               ` Viresh Kumar
2013-06-03 16:12                 ` Stratos Karafotis
2013-06-03 10:32           ` Rafael J. Wysocki
2013-05-31  8:54 ` Viresh Kumar
2013-05-31 12:42   ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2135481.eCRs7DzAb6@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=cpufreq@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=stratosk@semaphore.gr \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox