RE: [PATCH 2/2] cpufreq: update lpj only if frequency has changed

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

 



Hi,

Forwarding as the original is not yet seen in cpufreq archives.

Regards
Afzal

On Wed, Jan 04, 2012 at 10:52:46, Mohammed, Afzal wrote:
> During scaling up of cpu frequency, loops_per_jiffy
> is updated upon invoking PRECHANGE notifier.
> If setting to new frequency fails in cpufreq driver,
> lpj is left at incorrect value.
> 
> Hence update lpj only if cpu frequency is changed,
> i.e. upon invoking POSTCHANGE notifier.
> 
> Penalty would be that during time period between
> changing cpu frequency & invocation of POSTCHANGE
> notifier, udelay(x) may not gurantee minimal delay
> of 'x' us for frequency scaling up operation.
> 
> Perhaps a better solution would be to define
> CPUFREQ_ABORTCHANGE & handle accordingly, but then
> it would be more intrusive (using ABORTCHANGE may
> help drivers also; if any has registered notifier
> and expect POST for a PRECHANGE, their needs can
> be taken care using ABORT)
> 
> Signed-off-by: Afzal Mohammed <afzal@xxxxxx>
> ---
>  drivers/cpufreq/cpufreq.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 987a165..2f5801a 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -204,8 +204,7 @@ static void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
>  		pr_debug("saving %lu as reference value for loops_per_jiffy; "
>  			"freq is %u kHz\n", l_p_j_ref, l_p_j_ref_freq);
>  	}
> -	if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
> -	    (val == CPUFREQ_POSTCHANGE && ci->old > ci->new) ||
> +	if ((val == CPUFREQ_POSTCHANGE  && ci->old != ci->new) ||
>  	    (val == CPUFREQ_RESUMECHANGE || val == CPUFREQ_SUSPENDCHANGE)) {
>  		loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq,
>  								ci->new);
> -- 
> 1.7.1
> 
> 

--
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