Commit 16fea1db authored by Ingo Molnar's avatar Ingo Molnar

- set_cpus_allowed() optimization from Mike Kravetz: we can

  set p->thread_info->cpu directly if the task is not running
  and is not on any runqueue.
parent 7249e7d7
...@@ -1725,7 +1725,15 @@ void set_cpus_allowed(task_t *p, unsigned long new_mask) ...@@ -1725,7 +1725,15 @@ void set_cpus_allowed(task_t *p, unsigned long new_mask)
task_rq_unlock(rq, &flags); task_rq_unlock(rq, &flags);
goto out; goto out;
} }
/*
* If the task is not on a runqueue (and not running), then
* it is sufficient to simply update the task's cpu field.
*/
if (!p->array && (p != rq->curr)) {
p->thread_info->cpu = __ffs(p->cpus_allowed);
task_rq_unlock(rq, &flags);
goto out;
}
init_MUTEX_LOCKED(&req.sem); init_MUTEX_LOCKED(&req.sem);
req.task = p; req.task = p;
list_add(&req.list, &rq->migration_queue); list_add(&req.list, &rq->migration_queue);
......
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