forked from mirrors/linux
		
	cpufreq / intel_pstate: Optimize intel_pstate_set_policy
This function is called quite often from other subsystems. Removed unused call to intel_pstate_get_min_max(). Also when "policy->policy == CPUFREQ_POLICY_PERFORMANCE", then no need to do calculations as the limits will be forced anyway. Also corrected filename in the header. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
		
							parent
							
								
									49ded525d4
								
							
						
					
					
						commit
						d1b6848590
					
				
					 1 changed files with 9 additions and 12 deletions
				
			
		| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * cpufreq_snb.c: Native P state management for Intel processors
 | 
					 * intel_pstate.c: Native P state management for Intel processors
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * (C) Copyright 2012 Intel Corporation
 | 
					 * (C) Copyright 2012 Intel Corporation
 | 
				
			||||||
 * Author: Dirk Brandewie <dirk.j.brandewie@intel.com>
 | 
					 * Author: Dirk Brandewie <dirk.j.brandewie@intel.com>
 | 
				
			||||||
| 
						 | 
					@ -658,30 +658,27 @@ static unsigned int intel_pstate_get(unsigned int cpu_num)
 | 
				
			||||||
static int intel_pstate_set_policy(struct cpufreq_policy *policy)
 | 
					static int intel_pstate_set_policy(struct cpufreq_policy *policy)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct cpudata *cpu;
 | 
						struct cpudata *cpu;
 | 
				
			||||||
	int min, max;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cpu = all_cpu_data[policy->cpu];
 | 
						cpu = all_cpu_data[policy->cpu];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!policy->cpuinfo.max_freq)
 | 
						if (!policy->cpuinfo.max_freq)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	intel_pstate_get_min_max(cpu, &min, &max);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
 | 
					 | 
				
			||||||
	limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100);
 | 
					 | 
				
			||||||
	limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq;
 | 
					 | 
				
			||||||
	limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100);
 | 
					 | 
				
			||||||
	limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
 | 
						if (policy->policy == CPUFREQ_POLICY_PERFORMANCE) {
 | 
				
			||||||
		limits.min_perf_pct = 100;
 | 
							limits.min_perf_pct = 100;
 | 
				
			||||||
		limits.min_perf = int_tofp(1);
 | 
							limits.min_perf = int_tofp(1);
 | 
				
			||||||
		limits.max_perf_pct = 100;
 | 
							limits.max_perf_pct = 100;
 | 
				
			||||||
		limits.max_perf = int_tofp(1);
 | 
							limits.max_perf = int_tofp(1);
 | 
				
			||||||
		limits.no_turbo = 0;
 | 
							limits.no_turbo = 0;
 | 
				
			||||||
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						limits.min_perf_pct = (policy->min * 100) / policy->cpuinfo.max_freq;
 | 
				
			||||||
 | 
						limits.min_perf_pct = clamp_t(int, limits.min_perf_pct, 0 , 100);
 | 
				
			||||||
 | 
						limits.min_perf = div_fp(int_tofp(limits.min_perf_pct), int_tofp(100));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						limits.max_perf_pct = policy->max * 100 / policy->cpuinfo.max_freq;
 | 
				
			||||||
 | 
						limits.max_perf_pct = clamp_t(int, limits.max_perf_pct, 0 , 100);
 | 
				
			||||||
 | 
						limits.max_perf = div_fp(int_tofp(limits.max_perf_pct), int_tofp(100));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue