sched/clock, x86: Use a static_key for sched_clock_stable
authorPeter Zijlstra <peterz@infradead.org>
Thu, 28 Nov 2013 18:38:42 +0000 (19:38 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 13 Jan 2014 14:13:13 +0000 (15:13 +0100)
commit35af99e646c7f7ea46dc2977601e9e71a51dadd5
treed999820d233844278549cd826c4bfd6c7aa1ecc8
parentef08f0fff87630d4f67ceb09514d8b444df833f8
sched/clock, x86: Use a static_key for sched_clock_stable

In order to avoid the runtime condition and variable load turn
sched_clock_stable into a static_key.

Also provide a shorter implementation of local_clock() and
cpu_clock(int) when sched_clock_stable==1.

                        MAINLINE   PRE       POST

    sched_clock_stable: 1          1         1
    (cold) sched_clock: 329841     221876    215295
    (cold) local_clock: 301773     234692    220773
    (warm) sched_clock: 38375      25602     25659
    (warm) local_clock: 100371     33265     27242
    (warm) rdtsc:       27340      24214     24208
    sched_clock_stable: 0          0         0
    (cold) sched_clock: 382634     235941    237019
    (cold) local_clock: 396890     297017    294819
    (warm) sched_clock: 38194      25233     25609
    (warm) local_clock: 143452     71234     71232
    (warm) rdtsc:       27345      24245     24243

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/n/tip-eummbdechzz37mwmpags1gjr@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/tsc.c
include/linux/sched.h
kernel/sched/clock.c
kernel/sched/debug.c
kernel/time/tick-sched.c
kernel/trace/ring_buffer.c