Commit 9166c08
committed
Refactor priority-change path and introduce sched_migrate_task()
This commit introduces the sched_migrate_task() helper, which handles
migration of a task to the correct ready queue when its priority changes.
If the task is already in a ready queue, the helper dequeues it from the
old priority level, enqueues it into the new one, and updates all related
bookkeeping.
In addition, if a TASK_RUNNING task changes its priority, it now yields
immediately. This ensures that the scheduler always executes tasks in
strict priority order, preventing a running task from continuing to run
at an outdated priority level.1 parent ab4bcb5 commit 9166c08
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1015 | 1015 | | |
1016 | 1016 | | |
1017 | 1017 | | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
1018 | 1024 | | |
1019 | 1025 | | |
1020 | 1026 | | |
1021 | 1027 | | |
1022 | 1028 | | |
1023 | 1029 | | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
1024 | 1034 | | |
1025 | 1035 | | |
1026 | 1036 | | |
| |||
0 commit comments