Skip to contentSkip to conversation

sched/deadline: Compare against the donor in prio_changed_dl()

PATCH Superseded Zhan Xusheng 1 participant 1 message Sep 24 Scheduler

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/deadline: Compare against the donor in prio_changed_dl()

prio_changed_dl() dispatches on task_current_donor(), so the else branch asks whether p should preempt the current scheduling context. Under proxy execution that is rq->donor; rq->curr may be a mutex owner running on the donor's parameters.

commit af0c8b2bf67b ("sched: Split scheduler and execution contexts") converted the identical branch of prio_changed_rt() to rq->donor, but in deadline.c converted only the dispatch condition.

No behavioural change intended. The donor is picked as the earliest-deadline entity, so the donor test implies the curr test and the current code only adds reschedules. That ordering comes from the pick, not from here.

Fixes af0c8b2bf67b ("sched: Split scheduler and execution contexts")

---

Built with CONFIG_SCHED_PROXY_EXEC=y and =n; with =n the two rq members are an anonymous union and build_policy.o is byte-identical.

Two more sites in deadline.c were left behind by the same commit, both a few lines below an rq->donor based update_curr() call:

	dl_server_timer():
		if (!dl_task(dl_se->rq->curr) ||
		    dl_entity_preempt(dl_se, &dl_se->rq->curr->dl))

	dl_server_start():
		if (!dl_task(dl_se->rq->curr) ||
		    dl_entity_preempt(dl_se, &rq->curr->dl))

I left them out because that area is being reworked around dl_rq->curr; say the word and I will send them too.

 kernel/sched/deadline.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/deadline.c +2 -2
index de6a361a87c7..2a5e562fcb69 100644
@@ -3631,8 +3631,8 @@ static void prio_changed_dl(struct rq *rq, struct task_struct *p, u64 old_deadli
 		 *
 		 * Otherwise, if p was given an earlier deadline, reschedule.
 		 */
-		if (!dl_task(rq->curr) ||
-		    dl_time_before(p->dl.deadline, rq->curr->dl.deadline))
+		if (!dl_task(rq->donor) ||
+		    dl_time_before(p->dl.deadline, rq->donor->dl.deadline))
 			resched_curr(rq);
 	}
 }

base-commit: a9b3c7570564de40acb0998ab85c89d546b2122f

Signature · 1 line
2.43.0