[RFC PATCH 08/16] sched/deadline: Prepare for blocking and proxy activation with MIGRATING flag
From: K Prateek Nayak
Date: Wed Aug 26 2026 - 02:35:26 EST
Blocking deadline task sets task_not_contending() to retain bandwidth
and start zero-lag timer on the rq and depends on migrate_task_rq_dl()
via set_task_cpu() to remove them if the task migrates at wakeup.
When DEQUEUE_SLEEP is coupled with DEQUEUE_MIGRATING, the task_cpu() can
be switched via proxy_set_task_cpu() after the task is dequeued.
To balance this, enqueue path will add ENQUEUE_MIGRATING on the activate
path for symmetry with migrated blocking.
Treat SLEEP or WAKEUP with MIGRATING as simple migration and prevent
bandwidth modifiction, inactive timers programming on the rq since
task_rq() may resolve differently.
Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
---
XXX: Does this break EDF if we are blocking with 0-lag point still ahead
of us and not set task_non_contending()?
---
kernel/sched/deadline.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 9abda560c633..886ba6bfa868 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -471,7 +471,7 @@ static void task_contending(struct sched_dl_entity *dl_se, int flags)
* If this is a non-deadline task that has been boosted,
* do nothing
*/
- if (dl_se->dl_runtime == 0)
+ if (dl_se->dl_runtime == 0 || (flags & ENQUEUE_MIGRATING))
return;
if (flags & ENQUEUE_MIGRATED)
@@ -2477,8 +2477,13 @@ static void dequeue_dl_entity(struct sched_dl_entity *dl_se, int flags)
* way, because from GRUB's point of view the same thing is happening
* (the task moves from "active contending" to "active non contending"
* or "inactive")
+ *
+ * XXX: Proxy execution can block task with DEQUEUE_MIGRATING and
+ * switch the task_cpu() underneath without going through
+ * migrate_task_rq_dl(). Do not leave any bandwidth or timer reference
+ * back when DEQUEUE_SLEEP is coupled with DEQUEUE_MIGRATING
*/
- if (flags & DEQUEUE_SLEEP)
+ if ((flags & (DEQUEUE_SLEEP|DEQUEUE_MIGRATING)) == DEQUEUE_SLEEP)
task_non_contending(dl_se, true);
}
--
2.34.1