Commit 9bc9235
committed
Refactor priority-change path in mo_task_priority()
Previously, mo_task_priority() only updated the task’s time slice and
priority level. With the new scheduler design, tasks are kept in
per-priority ready queues, so mo_task_priority() must also handle
migrating tasks between these queues.
This commit adds dequeue/enqueue logic for tasks in TASK_RUNNING or
TASK_READY state, as such tasks must reside in a ready queue and a
priority change implies ready-queue migration.
The priority fields are still updated as part of the migration path:
sched_dequeue_task() relies on the current priority, while the enqueue
operation needs the new priority. Therefore, the priority update is
performed between the dequeue and enqueue steps.
If the priority change happens while the task is running, it must yield
immediately to preserve the scheduler’s strict task-ordering policy.1 parent 8e7c1b3 commit 9bc9235
1 file changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
996 | 996 | | |
997 | 997 | | |
998 | 998 | | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
999 | 1013 | | |
1000 | 1014 | | |
1001 | 1015 | | |
1002 | 1016 | | |
1003 | 1017 | | |
1004 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
1005 | 1023 | | |
1006 | 1024 | | |
1007 | 1025 | | |
| |||
0 commit comments