Revert "sched/deadline: Remove cpu_active_mask from cpudl_find()"

This reverts commit 9659e1ee. The change leaves a possibility of
scheduling dl task on offline cpu. The original commit text suggests
that it should not be a problem since migrate_tasks() will take care of
it, but there can be delay between marking cpu as offline and
migrate_tasks() call since they are called on different hotplug
notifications-offline happens on CPUHP_TEARDOWN_CPU while
migrate_tasks() gets called on CPUHP_AP_SCHED_STARTING. And in
between this duration there is a chance the dl task can get scheduled on
this offline cpu and lead to BUG_ON. Hence revert the change.

Change-Id: I6f4ea10d2ce4e83e12d36b9b90b1b630ffe4fc74
[pujag@codeaurora.org: fix minor conflicts due to reorg of the code]
Signed-off-by: Puja Gupta <pujag@codeaurora.org>
[satyap@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Puja Gupta 2019-03-13 15:24:43 -07:00 • committed by Satya Durga Srinivasu Prabhala
commit 44d528b138

View file

@ -120,7 +120,8 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
const struct sched_dl_entity *dl_se = &p->dl;
if (later_mask &&
cpumask_and(later_mask, cp->free_cpus, p->cpus_ptr)) {
cpumask_and(later_mask, cp->free_cpus, p->cpus_ptr) &&
cpumask_and(later_mask, later_mask, cpu_active_mask)) {
return 1;
} else {
int best_cpu = cpudl_maximum(cp);
@ -128,6 +129,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
if (cpumask_test_cpu(best_cpu, p->cpus_ptr) &&
cpumask_test_cpu(best_cpu, cpu_active_mask) &&
dl_time_before(dl_se->deadline, cp->elements[0].dl)) {
if (later_mask)
cpumask_set_cpu(best_cpu, later_mask);