Repository navigation
Conversation
…xt() (tier4#814) After tier4#809, `get_next_task()` is always called with `execution_ensured == true`, so the parameter and the `false` branches of the schedulers are dead code. Remove the parameter from `Scheduler::get_next()`, `scheduler::get_next_task()`, and `task::get_next_task()`. The dequeued task is now unconditionally marked as running. The behavior does not change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
execution_ensured parameter of Scheduler::get_next() and get_next_task()
ytakano
marked this pull request as ready for review
November 25, 2026 09:39
atsushi421
reviewed
Nov 25, 2026
| set_current_task(awkernel_lib::cpu::cpu_id(), task.id); | ||
| } | ||
| task_info.state = State::Running; | ||
| set_current_task(awkernel_lib::cpu::cpu_id(), task.id); |
Contributor
There was a problem hiding this comment.
get_next() binds cpu_id at the top, but this line calls awkernel_lib::cpu::cpu_id() again while three locks are held. On x86_64 that call runs CPUID and a linear search. Use set_current_task(cpu_id, task.id); instead.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Remove the
execution_ensuredparameter ofScheduler::get_next()andget_next_task().After #809,
get_next_task()is always called withexecution_ensured == true, so the parameter and thefalsebranches of the schedulers are dead code. The behavior does not change.All paths are under
awkernel_async_lib/src/.scheduler.rsScheduler::get_next()andscheduler::get_next_task(): remove the parameter.Scheduler::get_next_if()said "Unlikeget_next(true)". It now says "Unlikeget_next()".Scheduler::get_next()now says that the dequeued task is marked as running on the calling CPU.scheduler/prioritized_fifo.rs,scheduler/prioritized_rr.rs,scheduler/clustered.rs,scheduler/panicked.rsget_next(): remove the parameter and theif execution_ensured { ... }condition, and keep its body.task.rsget_next_task(): remove the parameter and theif execution_ensuredcondition aroundset_current_task().run_main(): callget_next_task()without the argument.Related links
execution_ensuredparameter ofScheduler::get_next()and `get_next_task() #814How was this PR tested?
scripts/ci.shpasses on my machine.scripts/ci.shwas not run. The following were run instead.make clippy: no warnings or errors on all targets.cargo +nightly-2026-11-09 check_x86,check_std,check_rv32andcheck_rv64pass.cargo +nightly-2026-11-09 test_awkernel_lib,test_awkernel_async_libandtest_awkernel_driverspass.test_smoltcpandtest_rd_gen_to_dagswere not run.make x86_64 RELEASE=1builds.test_multi_prioritized_scheduler: all 15 low-priority tasks and all 15 high-priority tasks started and finished.test_prioritized_rr: in about 57 seconds, each of the 24 high-priority tasks ran 505 to 518 times. The low-priority tasks did not run after the first second, as the test intends.Notes for reviewers
execution_ensuredparameter ofScheduler::get_next()and `get_next_task() #814 listsscheduler/edf.rs. That file no longer exists onmainafter feat(scheduler): separated EDF from common clustered scheduling logic #813, so the change is made inscheduler/clustered.rs.mdbook/src/internal/scheduler.mdalready showsget_next()andget_next_task()without the parameter, so it is not changed.make checkfails atcheck_aarch64onmaintoo, whenBSPis not given. The errors are inkernel/and do not come from this PR.