Repository navigation
feat(scheduler): Add Least Latest Finish Time (LLFT) scheduler - #815
romancardenas wants to merge 3 commits into
Conversation
|
The PR is divided into three commits:
|
| /// Missing job/timing means the scheduler falls back to the real deadline. | ||
| fn released_job_latest_finish(dag_info: &DagInfo) -> Option<u64> { | ||
| let dag = get_dag(dag_info.dag_id)?; | ||
| let job = dag.get_or_release_job(to_node_index(dag_info.node_id), false)?; |
There was a problem hiding this comment.
calculate_dag_latest_finish_priority looks up the job twice, so each LLFT wake takes the DAGS, jobs and graph locks about twice as often as EDF, all under the task.info lock. The second get_or_release_job also rewrites deadline_job. If the source releases the job between the two calls, the task keeps the fallback deadline and has_stale_deadline no longer corrects it. A single lookup that returns the JobInfo and the node's timing from the same graph critical section fixes both, and EDF and LLFT can share it.
|
|
||
| /// Returns the estimates computed during DAG validation for a node ID from [`DagInfo`]. | ||
| /// Analysis is invalidated when the graph or its sink deadline changes. | ||
| pub fn timing_info(&self, node_id: u32) -> Result<TimingInfo, DagError> { |
There was a problem hiding this comment.
Outside this module, only test_llft calls timing_info, and it relies on node IDs that follow registration order, which no API returns or documents. Future schedulers live in this crate, so pub(crate) is enough, and the unit tests in this file already cover the estimates.
| match self.node_weight_mut(node_idx) { | ||
| Some(info) => { | ||
| info.relative_deadline = Some(deadline); | ||
| self.clear_timing(); |
There was a problem hiding this comment.
compute_timing runs only in finish_create_dags, so a register_* call after that clears the timing of every node, and LLFT then orders by the real deadline with no log or error. A log::warn! when existing timing is cleared, or a rejection of registration on a spawned DAG, makes this visible.
| ### Least Latest Finish Time (LLFT) Scheduler | ||
|
|
||
| `SchedulerType::LLFT(relative_deadline, cpu_set)` schedules the **earliest** estimated | ||
| latest finish first. It shares EDF's clustered queue, affinity normalization, wake-time |
There was a problem hiding this comment.
llft::SCHEDULER is a separate ClusteredScheduler with its own queue, so LLFT shares the implementation with EDF but not the queue. This section also lacks the link to llft.rs that the other sections have, and it does not say that preemption (PriorityInfo) uses the latest-finish key and not the real deadline.
| } | ||
|
|
||
| #[test] | ||
| fn affinity_queue_orders_latest_finish_then_wake_time() { |
There was a problem hiding this comment.
This test only pushes literal tuples into AffinityBTreeQueue and pops them, so it passes even if LeastLatestFinish is wrong or removed. I suggest removing it, because latest_finish_priority_tracks_each_released_job_and_keeps_real_deadline covers the key and test_llft covers the order.
| test_edf::run().await; // test for EDF scheduler | ||
|
|
||
| #[cfg(feature = "test_llft")] | ||
| test_llft::run().await?; |
There was a problem hiding this comment.
The other test applications return () and log their own result. With ?, a test_llft failure stops userland::run(), so any application added after it does not run, and the failure shows only as the generic task-failure warning. Can run() log the error with log::error! and return () like its siblings?
| /// A forward pass computes `EF(v) = max(EF(p)) + C(v)` over predecessors, including the | ||
| /// sink's own WCET. | ||
| /// | ||
| /// A |
There was a problem hiding this comment.
The doc comment stops at /// A. It probably meant to describe the backward pass, for example "A backward pass computes LF(v) = min(LF(s) - C(s)) over successors, starting from the sink deadline."
| assert_eq!(info(sink).estimated_wcet(), Duration::ZERO); | ||
| let source = dag.get_source_nodes()[0]; | ||
| assert_eq!(info(source).estimated_wcet(), Duration::ZERO); | ||
| assert_eq!(info(source).estimated_wcet(), Duration::ZERO); |
There was a problem hiding this comment.
This line repeats the assertion above it. Was earliest_start() the intended assertion?
| @@ -0,0 +1,66 @@ | |||
| //! Least latest finish time first, distinct from the real job deadline. | |||
There was a problem hiding this comment.
There is a full-width space (U+3000) between "finish" and "time". The name also differs from "Least Latest Finish Time (LLFT)" used elsewhere.
LLFT looks fine! |
Description
TimingInfoestimates during DAG validation, including earliest/latest start and finish, slack, and critical-path membership.test_llft, an end-to-end example that pins the DAG to one worker and verifies the earlier-latest-finish branch runs first, even though the other branch is published first.How was this PR tested?
scripts/ci.shpasses on my machine.cargo fmt --all -- --check— passed.cargo test_awkernel_async_lib llft -- --nocapture— passed (2 tests).cargo x86 --features test_llft— passed.cargo clippy_x86 --features test_llft -- -D warnings— passed.make x86_64 OPT='--features debug --features test_llft'— passed.make qemu-x86_64-nographic— QEMU booted with 16 CPUs and printedtest_llft: early then late on CPU 1; DAG completed [OK]. QEMU was stopped after the result.Notes for reviewers