aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2016-07-20 11:37:41 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2016-07-20 11:46:29 -0400
commitbbef912ffe78f50d2df598939c0aee2bcfb663d9 (patch)
tree3edbc539c0bf587a759a98917cc6401ad096bbf4
parent3047e0353fea3f08a189afc13de8cc23f0bcedb6 (diff)
LITMUS^RT core: hook into hrtimer_nanosleep()
To intercept absolute-timed nanosleeps relative to CLOCK_MONOTONIC, which are likely related to periodic job arrivals.
-rw-r--r--kernel/time/hrtimer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index a6d5b061ee67..0cc8ab474d4a 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1622,6 +1622,19 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1622 if (dl_task(current) || rt_task(current) || is_realtime(current)) 1622 if (dl_task(current) || rt_task(current) || is_realtime(current))
1623 slack = 0; 1623 slack = 0;
1624 1624
1625 if (is_realtime(current)
1626 && clockid == CLOCK_MONOTONIC
1627 && mode == HRTIMER_MODE_ABS) {
1628 /* special handling: to handle periodic activations
1629 * correctly despite timer interrupt jitter and overheads,
1630 * the plugin might need to know the time at which the
1631 * task intends to wake up
1632 */
1633 tsk_rt(current)->doing_abs_nanosleep = 1;
1634 tsk_rt(current)->nanosleep_wakeup =
1635 ktime_to_ns(timespec_to_ktime(*rqtp));
1636 }
1637
1625 hrtimer_init_on_stack(&t.timer, clockid, mode); 1638 hrtimer_init_on_stack(&t.timer, clockid, mode);
1626 hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack); 1639 hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack);
1627 if (do_nanosleep(&t, mode)) 1640 if (do_nanosleep(&t, mode))
@@ -1648,6 +1661,9 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1648 ret = -ERESTART_RESTARTBLOCK; 1661 ret = -ERESTART_RESTARTBLOCK;
1649out: 1662out:
1650 destroy_hrtimer_on_stack(&t.timer); 1663 destroy_hrtimer_on_stack(&t.timer);
1664
1665 tsk_rt(current)->doing_abs_nanosleep = 0;
1666
1651 return ret; 1667 return ret;
1652} 1668}
1653 1669