[PATCH]sched/rt.c: Don't pull tasks to throttled rt_rq's

From: Kirill Tkhai
Date: Thu Nov 22 2012 - 15:36:30 EST


The most probably, next after pull_rt_task action will be picking a task
from the rq. So it's useless to pull tasks whose (corresponding to rq)
rt_rq is throttled.

Signed-off-by: Kirill V Tkhai <tkhai@xxxxxxxxx>
CC: Steven Rostedt <rostedt@xxxxxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxxxxx>
CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
---
kernel/sched/rt.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 418feb0..10863e4 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1708,6 +1708,16 @@ static void push_rt_tasks(struct rq *rq)
;
}

+static inline int remote_rt_rq_throttled(struct task_struct *p, int remote_cpu)
+{
+ struct rt_rq *rt_rq = rt_rq_of_se(&p->rt);
+ struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq);
+
+ rt_rq = sched_rt_period_rt_rq(rt_b, remote_cpu);
+
+ return rt_rq_throttled(rt_rq);
+}
+
static int pull_rt_task(struct rq *this_rq)
{
int this_cpu = this_rq->cpu, ret = 0, cpu;
@@ -1768,6 +1778,9 @@ static int pull_rt_task(struct rq *this_rq)
if (p->prio < src_rq->curr->prio)
goto skip;

+ if (remote_rt_rq_throttled(p, this_cpu))
+ goto skip;
+
ret = 1;

deactivate_task(src_rq, p, 0);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/