summaryrefslogtreecommitdiff
path: root/kernel/sched
diff options
context:
space:
mode:
authorCon Kolivas <kernel@kolivas.org>2016-10-09 17:42:55 +1100
committerCon Kolivas <kernel@kolivas.org>2016-10-09 17:42:55 +1100
commit5d1453de40618c733946c14c835adba3e3c5f10a (patch)
tree234d3559503e3637ac64cc131933f7d1cead6666 /kernel/sched
parent0bca0080e7b58e6c797057d1391a47c2fc81c56d (diff)
check_affinity_switch
Diffstat (limited to 'kernel/sched')
-rw-r--r--kernel/sched/MuQSS.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/sched/MuQSS.c b/kernel/sched/MuQSS.c
index 4d18a6df91c9..cebab13bd907 100644
--- a/kernel/sched/MuQSS.c
+++ b/kernel/sched/MuQSS.c
@@ -1714,7 +1714,7 @@ static inline int select_best_cpu(struct task_struct *p)
if (!other_rq->online)
continue;
- if (other_rq != rq && needs_other_cpu(p, other_rq->cpu))
+ if (needs_other_cpu(p, other_rq->cpu))
continue;
entries = rq_load(other_rq);
if (entries >= idlest)
@@ -5707,7 +5707,7 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,
if (cpumask_test_cpu(task_cpu(p), new_mask))
goto out;
- if (task_running(rq, p)) {
+ if (task_running(rq, p) || p->state == TASK_WAKING) {
/* Task is running on the wrong cpu now, reschedule it. */
if (rq == this_rq()) {
set_tsk_need_resched(p);
@@ -5718,9 +5718,12 @@ static int __set_cpus_allowed_ptr(struct task_struct *p,
int dest_cpu = cpumask_any_and(cpu_valid_mask, new_mask);
struct rq *dest_rq = cpu_rq(dest_cpu);
+ /* Switch rq locks here */
lock_second_rq(rq, dest_rq);
set_task_cpu(p, dest_cpu);
- rq_unlock(dest_rq);
+ rq_unlock(rq);
+
+ rq = dest_rq;
}
out:
if (queued && !cpumask_subset(new_mask, &old_mask))