diff options
Diffstat (limited to 'kernel/sched_rt.c')
-rw-r--r-- | kernel/sched_rt.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index 95f36f61ae1d..ac7d06786454 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -151,8 +151,27 @@ yield_task_rt(struct rq *rq) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | #ifdef CONFIG_SMP | 153 | #ifdef CONFIG_SMP |
154 | static int find_lowest_rq(struct task_struct *task); | ||
155 | |||
154 | static int select_task_rq_rt(struct task_struct *p, int sync) | 156 | static int select_task_rq_rt(struct task_struct *p, int sync) |
155 | { | 157 | { |
158 | struct rq *rq = task_rq(p); | ||
159 | |||
160 | /* | ||
161 | * If the task will not preempt the RQ, try to find a better RQ | ||
162 | * before we even activate the task | ||
163 | */ | ||
164 | if ((p->prio >= rq->rt.highest_prio) | ||
165 | && (p->nr_cpus_allowed > 1)) { | ||
166 | int cpu = find_lowest_rq(p); | ||
167 | |||
168 | return (cpu == -1) ? task_cpu(p) : cpu; | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * Otherwise, just let it ride on the affined RQ and the | ||
173 | * post-schedule router will push the preempted task away | ||
174 | */ | ||
156 | return task_cpu(p); | 175 | return task_cpu(p); |
157 | } | 176 | } |
158 | #endif /* CONFIG_SMP */ | 177 | #endif /* CONFIG_SMP */ |