Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cb2d840 authored by Puja Gupta's avatar Puja Gupta
Browse files

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: default avatarPuja Gupta <pujag@codeaurora.org>
parent 47907c90
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -124,7 +124,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_allowed)) {
	    cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed) &&
	    cpumask_and(later_mask, later_mask, cpu_active_mask)) {
		return 1;
	} else {
		int best_cpu = cpudl_maximum(cp);
@@ -132,6 +133,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_allowed) &&
		    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);