Commit 40cbc78
committed
Use mo_task_migration() in mo_task_priority()
This change refactors the priority update process in mo_task_priority()
to include early-return checks and proper task migration handling.
- Early-return conditions:
* Prevent modification of the idle task.
* Disallow assigning TASK_PRIO_IDLE to non-idle tasks.
The idle task is created by idle_task_init() during system startup and
must retain its fixed priority.
- Task migration:
If the priority-changed task resides in a ready queue (TASK_READY or
TASK_RUNNING), sched_migrate_task() is called to move it to the queue
corresponding to the new priority.
- Running task behavior:
When the current running task changes its own priority, it yields the
CPU so the scheduler can dispatch the next highest-priority task.1 parent 9047532 commit 40cbc78
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
862 | 862 | | |
863 | 863 | | |
864 | 864 | | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
865 | 871 | | |
866 | 872 | | |
867 | 873 | | |
868 | 874 | | |
869 | 875 | | |
870 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
871 | 881 | | |
872 | 882 | | |
873 | 883 | | |
| |||
0 commit comments