diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-08-09 07:18:54 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2017-05-26 17:12:36 -0400 |
commit | a595668af66abe391bcbae9bb2dc4bd07514aa69 (patch) | |
tree | 7d985663e78b90ff514e9af3dc5eb1e2e6229cc2 | |
parent | 7402122d4848083c3c3bc19dafb0d5dea92776fd (diff) |
Hook into SCHED_DEADLINE to protect LITMUS^RT tasks
SCHED_DEADLINE should not preempt LITMUS^RT tasks, as the LITMUS^RT
scheduling class is positioned above the SCHED_DEADLINE policy.
-rw-r--r-- | kernel/sched/deadline.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index c95c5122b105..f27f6f2b9f31 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -16,6 +16,8 @@ | |||
16 | */ | 16 | */ |
17 | #include "sched.h" | 17 | #include "sched.h" |
18 | 18 | ||
19 | #include <litmus/litmus.h> | ||
20 | |||
19 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
20 | 22 | ||
21 | struct dl_bandwidth def_dl_bandwidth; | 23 | struct dl_bandwidth def_dl_bandwidth; |
@@ -650,15 +652,17 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) | |||
650 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); | 652 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); |
651 | if (dl_task(rq->curr)) | 653 | if (dl_task(rq->curr)) |
652 | check_preempt_curr_dl(rq, p, 0); | 654 | check_preempt_curr_dl(rq, p, 0); |
653 | else | 655 | else if (!is_realtime(rq->curr)) |
654 | resched_curr(rq); | 656 | resched_curr(rq); |
655 | 657 | ||
656 | #ifdef CONFIG_SMP | 658 | #ifdef CONFIG_SMP |
657 | /* | 659 | /* |
658 | * Queueing this task back might have overloaded rq, check if we need | 660 | * Queueing this task back might have overloaded rq, check if we need |
659 | * to kick someone away. | 661 | * to kick someone away. |
662 | * | ||
663 | * LITMUS^RT: don't incur this overhead if we are running a L^RT task. | ||
660 | */ | 664 | */ |
661 | if (has_pushable_dl_tasks(rq)) { | 665 | if (has_pushable_dl_tasks(rq) && !is_realtime(rq->curr)) { |
662 | /* | 666 | /* |
663 | * Nothing relies on rq->lock after this, so its safe to drop | 667 | * Nothing relies on rq->lock after this, so its safe to drop |
664 | * rq->lock. | 668 | * rq->lock. |
@@ -1699,8 +1703,11 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p) | |||
1699 | * Since this might be the only -deadline task on the rq, | 1703 | * Since this might be the only -deadline task on the rq, |
1700 | * this is the right place to try to pull some other one | 1704 | * this is the right place to try to pull some other one |
1701 | * from an overloaded cpu, if any. | 1705 | * from an overloaded cpu, if any. |
1706 | * | ||
1707 | * LITMUS^RT: also don't pull tasks when we are running L^RT tasks. | ||
1702 | */ | 1708 | */ |
1703 | if (!task_on_rq_queued(p) || rq->dl.dl_nr_running) | 1709 | if (!task_on_rq_queued(p) || rq->dl.dl_nr_running |
1710 | || is_realtime(rq->curr)) | ||
1704 | return; | 1711 | return; |
1705 | 1712 | ||
1706 | queue_pull_task(rq); | 1713 | queue_pull_task(rq); |
@@ -1714,7 +1721,7 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) | |||
1714 | { | 1721 | { |
1715 | 1722 | ||
1716 | /* If p is not queued we will update its parameters at next wakeup. */ | 1723 | /* If p is not queued we will update its parameters at next wakeup. */ |
1717 | if (!task_on_rq_queued(p)) | 1724 | if (!task_on_rq_queued(p) || is_realtime(rq->curr)) |
1718 | return; | 1725 | return; |
1719 | 1726 | ||
1720 | /* | 1727 | /* |