Re: [PATCH v2 linux-next] cpufreq: ondemand: Calculate gradient of CPU load to early increase frequency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Again,

On Thu, Feb 21, 2013 at 5:01 PM, Stratos Karafotis
<stratosk@xxxxxxxxxxxx> wrote:

> diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
> @@ -168,16 +174,29 @@ static void od_check_cpu(int cpu, unsigned int load_freq)
>         struct cpufreq_policy *policy = dbs_info->cdbs.cur_policy;
>         struct dbs_data *dbs_data = policy->governor_data;
>         struct od_dbs_tuners *od_tuners = dbs_data->tuners;
> +       unsigned int prev_load_freq;
>
>         dbs_info->freq_lo = 0;
>
> +       /*
> +        * Calculate the gradient of load_freq. If it is too steep we assume
> +        * that the load will go over up_threshold in next iteration(s) and
> +        * we increase the frequency immediately
> +        */
> +       if (od_tuners->early_demand) {
> +               prev_load_freq = dbs_info->prev_load_freq;
> +               dbs_info->prev_load_freq = load_freq;
> +
> +               if (load_freq > prev_load_freq && (load_freq - prev_load_freq >
> +                   od_tuners->grad_up_threshold * policy->cur)) {
> +                       dbs_freq_increase(dbs_info, policy, policy->max);
> +                       return;
> +               }
> +       }
> +
>         /* Check for frequency increase */
>         if (load_freq > od_tuners->up_threshold * policy->cur) {
> -               /* 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);
> +               dbs_freq_increase(dbs_info, policy, policy->max);
>                 return;
>         }

Not really against your implementation, but this is what i thought of how
it should look like (initially when i reviewed your V1)

int boost_freq = 0;

       if (od_tuners->early_demand) {
               if (load_freq > dbs_info->prev_load_freq && (load_freq
- dbs_info->prev_load_freq >
                   od_tuners->grad_up_threshold * policy->cur)) {
                   boost_freq = 1;
               }

               dbs_info->prev_load_freq = load_freq;
       }

        /* Check for frequency increase */
        if (boost_freq || (load_freq > od_tuners->up_threshold * policy->cur)) {
                 increase-freq;


This would get rid of duplicate calls to increase_freq() and also
avoid changing its
prototype.
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux