mirror of https://github.com/torvalds/linux.git
cpufreq: intel_pstate: Use likely() optimization in intel_pstate_sample()
The comment above the condition `if (cpu->last_sample_time)` clearly indicates that the branch is taken for the vast majority of invocations after the first sample in a cycle. The first sample is a one-time initialization case. Add likely() hint to the condition to improve branch prediction for this performance-critical path in intel_pstate_sample(). Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
7c0dde86c1
commit
02d09026a8
|
|
@ -2542,7 +2542,7 @@ static inline bool intel_pstate_sample(struct cpudata *cpu, u64 time)
|
||||||
* that sample.time will always be reset before setting the utilization
|
* that sample.time will always be reset before setting the utilization
|
||||||
* update hook and make the caller skip the sample then.
|
* update hook and make the caller skip the sample then.
|
||||||
*/
|
*/
|
||||||
if (cpu->last_sample_time) {
|
if (likely(cpu->last_sample_time)) {
|
||||||
intel_pstate_calc_avg_perf(cpu);
|
intel_pstate_calc_avg_perf(cpu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue