|
@@ -4666,7 +4666,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
|
|
dest_cpu = cpumask_any_and(cpu_active_mask, new_mask);
|
|
- if (task_on_rq_queued(p)) {
|
|
|
|
|
|
+ if (task_on_rq_queued(p) || p->state == TASK_WAKING) {
|
|
struct migration_arg arg = { p, dest_cpu };
|
|
struct migration_arg arg = { p, dest_cpu };
|
|
/* Need help from migration thread: drop lock and wait. */
|
|
/* Need help from migration thread: drop lock and wait. */
|
|
task_rq_unlock(rq, p, &flags);
|
|
task_rq_unlock(rq, p, &flags);
|
|
@@ -4799,6 +4799,12 @@ static int migration_cpu_stop(void *data)
|
|
* be on another cpu but it doesn't matter.
|
|
* be on another cpu but it doesn't matter.
|
|
*/
|
|
*/
|
|
local_irq_disable();
|
|
local_irq_disable();
|
|
|
|
+ /*
|
|
|
|
+ * We need to explicitly wake pending tasks before running
|
|
|
|
+ * __migrate_task() such that we will not miss enforcing cpus_allowed
|
|
|
|
+ * during wakeups, see set_cpus_allowed_ptr()'s TASK_WAKING test.
|
|
|
|
+ */
|
|
|
|
+ sched_ttwu_pending();
|
|
__migrate_task(arg->task, raw_smp_processor_id(), arg->dest_cpu);
|
|
__migrate_task(arg->task, raw_smp_processor_id(), arg->dest_cpu);
|
|
local_irq_enable();
|
|
local_irq_enable();
|
|
return 0;
|
|
return 0;
|