aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 7c5494dccd39..1be1a09b9dc9 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -3465,27 +3465,22 @@ void sched_exec(void)
3465{ 3465{
3466 struct task_struct *p = current; 3466 struct task_struct *p = current;
3467 unsigned long flags; 3467 unsigned long flags;
3468 struct rq *rq;
3469 int dest_cpu; 3468 int dest_cpu;
3470 3469
3471 rq = task_rq_lock(p, &flags); 3470 raw_spin_lock_irqsave(&p->pi_lock, flags);
3472 dest_cpu = p->sched_class->select_task_rq(p, SD_BALANCE_EXEC, 0); 3471 dest_cpu = p->sched_class->select_task_rq(p, SD_BALANCE_EXEC, 0);
3473 if (dest_cpu == smp_processor_id()) 3472 if (dest_cpu == smp_processor_id())
3474 goto unlock; 3473 goto unlock;
3475 3474
3476 /* 3475 if (likely(cpu_active(dest_cpu))) {
3477 * select_task_rq() can race against ->cpus_allowed
3478 */
3479 if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed) &&
3480 likely(cpu_active(dest_cpu)) && need_migrate_task(p)) {
3481 struct migration_arg arg = { p, dest_cpu }; 3476 struct migration_arg arg = { p, dest_cpu };
3482 3477
3483 task_rq_unlock(rq, p, &flags); 3478 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
3484 stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg); 3479 stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg);
3485 return; 3480 return;
3486 } 3481 }
3487unlock: 3482unlock:
3488 task_rq_unlock(rq, p, &flags); 3483 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
3489} 3484}
3490 3485
3491#endif 3486#endif