diff options
| author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2016-07-20 11:37:41 -0400 |
|---|---|---|
| committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2017-05-26 17:12:39 -0400 |
| commit | d0248852b359571c21aece3b50ddc7f6fa942c3f (patch) | |
| tree | 36d0ba7a4ec26ccb3c99b5ed9d811d526d6f7aa5 /kernel/time | |
| parent | 3ad97ff9c220de06e01f97c795fcee49f206595d (diff) | |
Hook into hrtimer_nanosleep()
To intercept absolute-timed nanosleeps relative to CLOCK_MONOTONIC,
which are likely related to periodic job arrivals.
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/hrtimer.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index c367854ce1d6..feeaaff14b57 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
| @@ -1593,6 +1593,19 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | |||
| 1593 | if (dl_task(current) || rt_task(current) || is_realtime(current)) | 1593 | if (dl_task(current) || rt_task(current) || is_realtime(current)) |
| 1594 | slack = 0; | 1594 | slack = 0; |
| 1595 | 1595 | ||
| 1596 | if (is_realtime(current) | ||
| 1597 | && clockid == CLOCK_MONOTONIC | ||
| 1598 | && mode == HRTIMER_MODE_ABS) { | ||
| 1599 | /* special handling: to handle periodic activations | ||
| 1600 | * correctly despite timer interrupt jitter and overheads, | ||
| 1601 | * the plugin might need to know the time at which the | ||
| 1602 | * task intends to wake up | ||
| 1603 | */ | ||
| 1604 | tsk_rt(current)->doing_abs_nanosleep = 1; | ||
| 1605 | tsk_rt(current)->nanosleep_wakeup = | ||
| 1606 | ktime_to_ns(timespec_to_ktime(*rqtp)); | ||
| 1607 | } | ||
| 1608 | |||
| 1596 | hrtimer_init_on_stack(&t.timer, clockid, mode); | 1609 | hrtimer_init_on_stack(&t.timer, clockid, mode); |
| 1597 | hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack); | 1610 | hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack); |
| 1598 | if (do_nanosleep(&t, mode)) | 1611 | if (do_nanosleep(&t, mode)) |
| @@ -1619,6 +1632,9 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp, | |||
| 1619 | ret = -ERESTART_RESTARTBLOCK; | 1632 | ret = -ERESTART_RESTARTBLOCK; |
| 1620 | out: | 1633 | out: |
| 1621 | destroy_hrtimer_on_stack(&t.timer); | 1634 | destroy_hrtimer_on_stack(&t.timer); |
| 1635 | |||
| 1636 | tsk_rt(current)->doing_abs_nanosleep = 0; | ||
| 1637 | |||
| 1622 | return ret; | 1638 | return ret; |
| 1623 | } | 1639 | } |
| 1624 | 1640 | ||
