From: Ingo Molnar Date: Thu, 26 Feb 2009 20:21:59 +0000 (+0100) Subject: Merge branch 'sched/clock' into tracing/ftrace X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=1b49061d400c9e51e3ac2aac026a099fe599b9bb;p=linux-beck.git Merge branch 'sched/clock' into tracing/ftrace Conflicts: kernel/sched_clock.c --- 1b49061d400c9e51e3ac2aac026a099fe599b9bb diff --cc kernel/sched_clock.c index db69174b1178,a755d023805a..7ec82c1c61c5 --- a/kernel/sched_clock.c +++ b/kernel/sched_clock.c @@@ -24,12 -24,11 +24,12 @@@ * The clock: sched_clock_cpu() is monotonic per cpu, and should be somewhat * consistent between cpus (never more than 2 jiffies difference). */ - #include - #include #include - #include - #include +#include + #include + #include + #include + #include /* * Scheduler clock - returns current time in nanosec units. @@@ -149,19 -155,13 +156,24 @@@ static void lock_double_clock(struct sc u64 sched_clock_cpu(int cpu) { - struct sched_clock_data *scd = cpu_sdc(cpu); u64 now, clock, this_clock, remote_clock; + struct sched_clock_data *scd; + + if (sched_clock_stable) + return sched_clock(); + + scd = cpu_sdc(cpu); + + /* + * Normally this is not called in NMI context - but if it is, + * trying to do any locking here is totally lethal. + */ + if (unlikely(in_nmi())) + return scd->clock; + + if (unlikely(!sched_clock_running)) + return 0ull; + WARN_ON_ONCE(!irqs_disabled()); now = sched_clock();