Skip to content

feat(scheduler): separated EDF from common clustered scheduling logic - #813

Open
romancardenas wants to merge 1 commit into
tier4:mainfrom
romancardenas:refactor/clustered-edf
Open

romancardenas wants to merge 1 commit into
tier4:mainfrom
romancardenas:refactor/clustered-edf

Conversation

@romancardenas

Copy link
Copy Markdown
Contributor

Description

Separate how clustered tasks run from how EDF orders them. clustered.rs handles CPU affinity, the ready queue, dispatch, and preemption. edf.rs supplies the ordering rule: the task with the earliest absolute deadline runs first among tasks eligible for the current CPU.

The internal ClusteredOrdering trait identifies the scheduler through KIND and supplies (absolute_deadline, ordering_time) once per wake:

Element Purpose
absolute_deadline The real job deadline, stored in the task’s metadata.
ordering_time The primary ready-queue key. The shared scheduler also uses it to derive preemption priority as MAX_TASK_PRIORITY - ordering_time, so earlier values rank higher.

EDF returns (deadline, deadline) because the real deadline also determines its ordering. The shared scheduler separately adds wake_time as the tie-breaker, so the actual EDF queue key remains (deadline, wake_time).

Related links

None.

How was this PR tested?

  • scripts/ci.sh passes on my machine.

Notes for reviewers

This is a behavior-preserving refactor. The two tuple elements are separate so a future scheduler can use a different ordering key without replacing the real deadline. This PR does not add Latest Finish scheduling or change DAG timing.

@atsushi421 atsushi421 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The # Implementing a clustered scheduler doc on the Scheduler trait in scheduler.rs and the last paragraph of the EDF section in mdbook/src/internal/scheduler.md still tell a new clustered scheduler to wrap its queue entries in ClusteredTask and to implement queued_cpu_mask() by hand. ClusteredScheduler<O> now does both, so consider pointing these texts to ClusteredOrdering instead. The PRIORITY_LIST prefix and is_clustered() requirement still applies.


scripts/ci.sh runs fmt, the target checks, clippy, udeps, and the host unit tests. None of these reach ClusteredScheduler::wake_task, get_next, or invoke_preemption. Please run test_edf and test_dag on QEMU and add the result to the description, because only those tests exercise the moved code.


let Some((victim_cpu, target_task)) = victim else {
return false;
let deadline = match &info.dag_info {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading info.dag_info directly here removes the only caller of TaskInfo::get_dag_info() in task.rs. Consider removing the accessor, unless it is part of the public API on purpose.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants