diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-19 08:30:20 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-03-20 14:30:31 -0400 |
| commit | 59a6e9efdd1b75c6e2c4a07bad361b4fa7aa741c (patch) | |
| tree | 6b7f64c8ec4f3b80a9fc3aff3c6285175948d3c7 | |
| parent | e9b22ab48acccba501490f05a367647fcb9902c2 (diff) | |
hrtimer integration: properly trace late-added timers
When tasks add timers that have already expired (e.g., when preempted
during schedule_hrtimeout), we should not use the expriration time as
the reference time point, but rather the time when the timer was added
(the delay then includes activation of ksoftirqd, etc.).
| -rw-r--r-- | include/linux/hrtimer.h | 2 | ||||
| -rw-r--r-- | kernel/time/hrtimer.c | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 8b4b87bf73fd..4cd94206e784 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -116,7 +116,7 @@ struct hrtimer { | |||
| 116 | void *start_site; | 116 | void *start_site; |
| 117 | char start_comm[16]; | 117 | char start_comm[16]; |
| 118 | #endif | 118 | #endif |
| 119 | #ifdef CONFIG_REPORT_TIMER_LATENCY | 119 | #if defined(CONFIG_REPORT_TIMER_LATENCY) || defined(CONFIG_SCHED_OVERHEAD_TRACE) |
| 120 | ktime_t when_added; | 120 | ktime_t when_added; |
| 121 | #endif | 121 | #endif |
| 122 | }; | 122 | }; |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 70aebc72dfb8..a6d5b061ee67 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
| @@ -1518,12 +1518,17 @@ static enum hrtimer_restart hrtimer_wakeup(struct hrtimer *timer) | |||
| 1518 | t->task = NULL; | 1518 | t->task = NULL; |
| 1519 | if (task) | 1519 | if (task) |
| 1520 | { | 1520 | { |
| 1521 | #ifdef CONFIG_SCHED_OVERHEAD_TRACE | ||
| 1521 | if (is_realtime(task)) | 1522 | if (is_realtime(task)) |
| 1522 | { | 1523 | { |
| 1523 | ktime_t expires = hrtimer_get_expires(timer); | 1524 | ktime_t expires = hrtimer_get_expires(timer); |
| 1524 | lt_t intended_release = ktime_to_ns(expires); | 1525 | /* Fix up timers that were added past their due date; |
| 1526 | * that's not really release latency. */ | ||
| 1527 | lt_t intended_release = max(expires.tv64, | ||
| 1528 | timer->when_added.tv64); | ||
| 1525 | TS_RELEASE_LATENCY(intended_release); | 1529 | TS_RELEASE_LATENCY(intended_release); |
| 1526 | } | 1530 | } |
| 1531 | #endif | ||
| 1527 | TS_RELEASE_START; | 1532 | TS_RELEASE_START; |
| 1528 | wake_up_process(task); | 1533 | wake_up_process(task); |
| 1529 | TS_RELEASE_END; | 1534 | TS_RELEASE_END; |
