Commit 8509486a authored by Ingo Molnar's avatar Ingo Molnar

- sync wakeup affinity fix: do not fast-migrate threads

  without making sure that the target CPU is allowed.
parent f042243c
...@@ -361,13 +361,18 @@ static int try_to_wake_up(task_t * p, int sync) ...@@ -361,13 +361,18 @@ static int try_to_wake_up(task_t * p, int sync)
rq = task_rq_lock(p, &flags); rq = task_rq_lock(p, &flags);
old_state = p->state; old_state = p->state;
if (!p->array) { if (!p->array) {
if (unlikely(sync && (rq->curr != p))) { /*
if (p->thread_info->cpu != smp_processor_id()) { * Fast-migrate the task if it's not running or runnable
* currently. Do not violate hard affinity.
*/
if (unlikely(sync && (rq->curr != p) &&
(p->thread_info->cpu != smp_processor_id()) &&
(p->cpus_allowed & (1UL << smp_processor_id())))) {
p->thread_info->cpu = smp_processor_id(); p->thread_info->cpu = smp_processor_id();
task_rq_unlock(rq, &flags); task_rq_unlock(rq, &flags);
goto repeat_lock_task; goto repeat_lock_task;
} }
}
if (old_state == TASK_UNINTERRUPTIBLE) if (old_state == TASK_UNINTERRUPTIBLE)
rq->nr_uninterruptible--; rq->nr_uninterruptible--;
activate_task(p, rq); activate_task(p, rq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment