Skip to contentSkip to conversation

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

PATCH New Kirill Tkhai 1 participant 1 message Nov 22, 2012 Scheduler

lore
Share & tools
lore
#0 lore raw

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

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.

CC Steven Rostedt <[email protected]>
CC Ingo Molnar <[email protected]>
CC Peter Zijlstra <[email protected]>
---
 kernel/sched/rt.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
kernel/sched/rt.c +13 -0
index 418feb0..10863e4 100644
@@ -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);