diff mbox

[RFC,3/6] sched/rt: Check to push FIFO current away at each tick

Message ID 1430068258-1960-3-git-send-email-xlpang@126.com
State New
Headers show

Commit Message

Xunlei Pang April 26, 2015, 5:10 p.m. UTC
From: Xunlei Pang <pang.xunlei@linaro.org>

There may be some non-migratable tasks queued in the "run queue"
with the same priority as current which is FIFO and migratable,
so at each tick we can check and try to push current away and
give these tasks a chance of running(we don't do this for tasks
queued with lower priority).

Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
---
 kernel/sched/rt.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 7b76747..ddd5b19 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2314,10 +2314,17 @@  static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued)
 
 	/*
 	 * RR tasks need a special form of timeslice management.
-	 * FIFO tasks have no timeslices.
+	 * FIFO tasks have no timeslices. But if p(current) is a
+	 * FIFO task, try to push it away.
 	 */
-	if (p->policy != SCHED_RR)
+	if (p->policy != SCHED_RR) {
+		if (p->nr_cpus_allowed > 1 &&
+		    rq->rt.rt_nr_running > 1 &&
+		    !test_tsk_need_resched(p))
+			check_preempt_equal_prio_common(rq);
+
 		return;
+	}
 
 	if (--p->rt.time_slice)
 		return;