@@ -1615,11 +1615,12 @@ static bool set_cpus_allowed_dl(struct task_struct *p,
weight = cpumask_weight(new_mask);
/*
- * Only update if the process changes its state from whether it
- * can migrate or not.
+ * Skip updating the migration stuff if the process doesn't change
+ * its migrate state, but still need to check if it can be pushed
+ * away due to its new affinity.
*/
if ((p->nr_cpus_allowed > 1) == (weight > 1))
- return false;
+ goto check_push;
/*
* The process used to be able to migrate OR it can now migrate
@@ -1637,6 +1638,18 @@ static bool set_cpus_allowed_dl(struct task_struct *p,
update_dl_migration(&rq->dl);
+check_push:
+ if (weight > 1 &&
+ !task_running(rq, p) &&
+ !test_tsk_need_resched(rq->curr) &&
+ !cpumask_subset(new_mask, &p->cpus_allowed)) {
+ /* Update new affinity and try to push. */
+ cpumask_copy(&p->cpus_allowed, new_mask);
+ p->nr_cpus_allowed = weight;
+ push_dl_tasks(rq);
+ return true;
+ }
+
return false;
}