aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_rt.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched_rt.c')
-rw-r--r--kernel/sched_rt.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index fe9da6084c87..64a8f0aa117b 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1192,7 +1192,6 @@ static int push_rt_task(struct rq *rq)
1192{ 1192{
1193 struct task_struct *next_task; 1193 struct task_struct *next_task;
1194 struct rq *lowest_rq; 1194 struct rq *lowest_rq;
1195 int paranoid = RT_MAX_TRIES;
1196 1195
1197 if (!rq->rt.overloaded) 1196 if (!rq->rt.overloaded)
1198 return 0; 1197 return 0;
@@ -1226,23 +1225,34 @@ static int push_rt_task(struct rq *rq)
1226 struct task_struct *task; 1225 struct task_struct *task;
1227 /* 1226 /*
1228 * find lock_lowest_rq releases rq->lock 1227 * find lock_lowest_rq releases rq->lock
1229 * so it is possible that next_task has changed. 1228 * so it is possible that next_task has migrated.
1230 * If it has, then try again. 1229 *
1230 * We need to make sure that the task is still on the same
1231 * run-queue and is also still the next task eligible for
1232 * pushing.
1231 */ 1233 */
1232 task = pick_next_pushable_task(rq); 1234 task = pick_next_pushable_task(rq);
1233 if (unlikely(task != next_task) && task && paranoid--) { 1235 if (task_cpu(next_task) == rq->cpu && task == next_task) {
1234 put_task_struct(next_task); 1236 /*
1235 next_task = task; 1237 * If we get here, the task hasnt moved at all, but
1236 goto retry; 1238 * it has failed to push. We will not try again,
1239 * since the other cpus will pull from us when they
1240 * are ready.
1241 */
1242 dequeue_pushable_task(rq, next_task);
1243 goto out;
1237 } 1244 }
1238 1245
1246 if (!task)
1247 /* No more tasks, just exit */
1248 goto out;
1249
1239 /* 1250 /*
1240 * Once we have failed to push this task, we will not 1251 * Something has shifted, try again.
1241 * try again, since the other cpus will pull from us
1242 * when they are ready
1243 */ 1252 */
1244 dequeue_pushable_task(rq, next_task); 1253 put_task_struct(next_task);
1245 goto out; 1254 next_task = task;
1255 goto retry;
1246 } 1256 }
1247 1257
1248 deactivate_task(rq, next_task, 0); 1258 deactivate_task(rq, next_task, 0);