Skip to content

Commit c78b17e

Browse files
Daniel Lezcanoingomolnar
authored andcommitted
sched/clock: Remove pointless test in cpu_clock/local_clock
In case the HAVE_UNSTABLE_SCHED_CLOCK config is set, the cpu_clock() version checks if sched_clock_stable() is not set and calls sched_clock_cpu(), otherwise it calls sched_clock(). sched_clock_cpu() checks also if sched_clock_stable() is set and, if true, calls sched_clock(). sched_clock() will be called in sched_clock_cpu() if sched_clock_stable() is true. Remove the duplicate test by directly calling sched_clock_cpu() and let the static key act in this function instead. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1460385514-14700-1-git-send-email-daniel.lezcano@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent fb90a6e commit c78b17e

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎kernel/sched/clock.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,7 @@ EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
375375
*/
376376
u64 cpu_clock(int cpu)
377377
{
378-
if (!sched_clock_stable())
379-
return sched_clock_cpu(cpu);
380-
381-
return sched_clock();
378+
return sched_clock_cpu(cpu);
382379
}
383380

384381
/*
@@ -390,10 +387,7 @@ u64 cpu_clock(int cpu)
390387
*/
391388
u64 local_clock(void)
392389
{
393-
if (!sched_clock_stable())
394-
return sched_clock_cpu(raw_smp_processor_id());
395-
396-
return sched_clock();
390+
return sched_clock_cpu(raw_smp_processor_id());
397391
}
398392

399393
#else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */

0 commit comments

Comments
 (0)