diff options
Diffstat (limited to 'kernel/sched_clock.c')
-rw-r--r-- | kernel/sched_clock.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c index a0b0852414cc..db69174b1178 100644 --- a/kernel/sched_clock.c +++ b/kernel/sched_clock.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
30 | #include <linux/ktime.h> | 30 | #include <linux/ktime.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/hardirq.h> | ||
32 | 33 | ||
33 | /* | 34 | /* |
34 | * Scheduler clock - returns current time in nanosec units. | 35 | * Scheduler clock - returns current time in nanosec units. |
@@ -151,6 +152,13 @@ u64 sched_clock_cpu(int cpu) | |||
151 | struct sched_clock_data *scd = cpu_sdc(cpu); | 152 | struct sched_clock_data *scd = cpu_sdc(cpu); |
152 | u64 now, clock, this_clock, remote_clock; | 153 | u64 now, clock, this_clock, remote_clock; |
153 | 154 | ||
155 | /* | ||
156 | * Normally this is not called in NMI context - but if it is, | ||
157 | * trying to do any locking here is totally lethal. | ||
158 | */ | ||
159 | if (unlikely(in_nmi())) | ||
160 | return scd->clock; | ||
161 | |||
154 | if (unlikely(!sched_clock_running)) | 162 | if (unlikely(!sched_clock_running)) |
155 | return 0ull; | 163 | return 0ull; |
156 | 164 | ||