* Ingo Molnar <[email protected]> wrote:
> thanks. It shows the anomaly in action:
> So all the time references we have show that (no surprise here) 1
> second passed between the two samples. But sched_clock() shows a
> _large_ jump:
>
> .clock : 125652924079659272
> .clock : 125653018059166371
>
> also reflected in .clock_max_delta:
>
> .clock_max_delta : 92976502936
>
> that's a 93 seconds jump (!) in a single 1-second sample. [...]
we also had a similar jump in exec_clock, which suggests that the
sched_clock() "jump" occured while there was a task running. (i.e. not
during ACPI-C2/C3) Could you try the patch below? It should catch such
large jumps. The 'clock_overflows' counter in /proc/sched_debug will
show whether this new protection triggered on your box.
Ingo
Index: linux/kernel/sched.c
===================================================================
--- linux.orig/kernel/sched.c
+++ linux/kernel/sched.c
@@ -149,12 +149,12 @@ struct rq {
u64 clock, prev_clock_raw;
s64 clock_max_delta;
- u64 fair_clock, prev_fair_clock;
- u64 exec_clock, prev_exec_clock;
+ u64 fair_clock, prev_fair_clock;
+ u64 exec_clock, prev_exec_clock;
s64 wait_runtime;
unsigned long wait_runtime_overruns, wait_runtime_underruns;
- unsigned int clock_warps;
+ unsigned int clock_warps, clock_overflows;
unsigned int clock_unstable_events;
struct sched_class *load_balance_class;
@@ -245,9 +245,17 @@ static inline unsigned long long __rq_cl
clock++;
rq->clock_warps++;
} else {
- if (unlikely(delta > rq->clock_max_delta))
- rq->clock_max_delta = delta;
- clock += delta;
+ /*
+ * Catch too large forward jumps too:
+ */
+ if (delta > 2*TICK_NSEC) {
+ clock++;
+ rq->clock_overflows++;
+ } else {
+ if (unlikely(delta > rq->clock_max_delta))
+ rq->clock_max_delta = delta;
+ clock += delta;
+ }
}
rq->prev_clock_raw = now;
Index: linux/kernel/sched_debug.c
===================================================================
--- linux.orig/kernel/sched_debug.c
+++ linux/kernel/sched_debug.c
@@ -117,13 +119,13 @@ static void print_cpu(struct seq_file *m
P(clock);
P(prev_clock_raw);
P(clock_warps);
+ P(clock_overflows);
P(clock_unstable_events);
P(clock_max_delta);
- rq->clock_max_delta = 0;
P(fair_clock);
- P(prev_fair_clock);
+ P(prev_fair_clock);
P(exec_clock);
- P(prev_exec_clock);
+ P(prev_exec_clock);
P(wait_runtime);
P(wait_runtime_overruns);
P(wait_runtime_underruns);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]