Re: [PATCH v10 7/7] x86/tsc: use tsc early

From: Peter Zijlstra
Date: Wed Jun 20 2018 - 05:15:58 EST


On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote:
> u64 native_sched_clock(void)
> {
> + if (static_branch_likely(&__use_tsc))
> + return cycles_2_ns(rdtsc());
>
> + if (static_branch_unlikely(&tsc_early_enabled)) {
> + if (tsc_early_sched_clock)
> + return cycles_2_ns(rdtsc());
> }

I'm still puzzled by the entire need for tsc_early_enabled and all that.
Esp. since both branches do the exact same thing:

return cycles_2_ns(rdtsc());