Skip to content

Commit 4958b46

Browse files
vireshkrafaeljw
authored andcommitted
cpufreq: stats: Mark few conditionals with unlikely()
Since this will be part of the scheduler's hotpath in some cases, use unlikely() for few of the obvious conditionals. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 381abb9 commit 4958b46

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/cpufreq/cpufreq_stats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
260260
struct cpufreq_stats *stats = policy->stats;
261261
int old_index, new_index;
262262

263-
if (!stats)
263+
if (unlikely(!stats))
264264
return;
265265

266266
if (unlikely(READ_ONCE(stats->reset_pending)))
@@ -270,7 +270,7 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
270270
new_index = freq_table_get_index(stats, new_freq);
271271

272272
/* We can't do stats->time_in_state[-1]= .. */
273-
if (old_index == -1 || new_index == -1 || old_index == new_index)
273+
if (unlikely(old_index == -1 || new_index == -1 || old_index == new_index))
274274
return;
275275

276276
cpufreq_stats_update(stats, stats->last_time);

0 commit comments

Comments
 (0)