Commit 0d16104
committed
Add sched_migrate_task() helper
This commit introduces a new API, sched_migrate_task(), which enables
migration of a task between ready queues of different priority levels.
The function safely removes the task from its current ready queue and
enqueues it into the target queue, updating the corresponding RR cursor
and ready bitmap to maintain scheduler consistency. This helper will be
used in mo_task_priority() and other task management routines that
adjust task priority dynamically.
Future improvement:
The current enqueue path allocates a new list node for each task
insertion based on its TCB pointer. In the future, this can be optimized
by directly transferring or reusing the existing list node between
ready queues, eliminating the need for an additional malloc() and free()
operations during priority migrations.1 parent bcbac6b commit 0d16104
1 file changed
+22
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
414 | 436 | | |
415 | 437 | | |
416 | 438 | | |
| |||
0 commit comments