You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Remove the execution_ensured parameter of Scheduler::get_next() and `get_next_task() #814
Remove the execution_ensured parameter of Scheduler::get_next() and get_next_task()
Description
After #809, get_next_task() is always called with execution_ensured == true, so the parameter and the false branches of the schedulers are dead code. This issue proposes to remove the parameter.
This was pointed out in the review of #809 (#809 (comment)). It is left out of #809 because the change touches all four schedulers.
Background
execution_ensured == false had one caller: PrioritizedRRScheduler::invoke_preemption_tick() called get_next_task(false) on the primary CPU to dequeue a task without marking it as running. #809 replaces that call with get_next_task_if(), which uses the new Scheduler::get_next_if().
The only remaining caller is run_main() in awkernel_async_lib/src/task.rs, and it passes true.
What to change
All paths are under awkernel_async_lib/src/.
scheduler.rs
Scheduler::get_next(&self, execution_ensured: bool): remove the parameter.
scheduler::get_next_task(execution_ensured: bool): remove the parameter.
get_next(): remove the parameter and the if execution_ensured { ... } condition, and keep its body. The body sets the state of the task to State::Running and calls set_current_task().
task.rs
get_next_task(execution_ensured: bool): remove the parameter and the if execution_ensured condition around set_current_task().
run_main(): call get_next_task() without the argument.
Comments and docs
The doc of Scheduler::get_next_if() says "Unlike get_next(true)". Reword it.
Check that mdbook/src/internal/scheduler.md still matches the signatures.
The behavior does not change.
Dependency
This depends on #809. On main, invoke_preemption_tick() still calls get_next_task(false), so the parameter cannot be removed before #809 is merged.
How to verify
make check and make clippy have no warnings or errors.
make test passes.
test_prioritized_rr and test_multi_prioritized_scheduler run on QEMU x86_64 as before.
Activity