cpufreq: intel_pstate: Use likely() optimization in intel_pstate_sample()
authorYaxiong Tian <tianyaxiong@kylinos.cn>
Fri, 12 Sep 2025 07:35:02 +0000 (15:35 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 19 Sep 2025 21:21:01 +0000 (23:21 +0200)
commit02d09026a88f227aa1f4687bd31d6ffc4970e8be
treee82f742f81744acf671b2bc8247158f70df573f1
parent7c0dde86c17665cb27e1c8dd23d263e2ed2d5b50
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>
drivers/cpufreq/intel_pstate.c