Repository navigation
feat(sched): merge GEDF into ClusteredEDF and rename it to EDF - #787
Merged
Merged
Conversation
GEDF is ClusteredEDF with every worker core in the CPU set, so one EDF scheduler covers both. Remove GEDFScheduler and SchedulerType::GEDF, and rename ClusteredEDF to EDF. SchedulerType::EDF(d, CpuSet::all()) gives global EDF, and a one-core CPU set gives partitioned EDF. - Move calculate_and_update_dag_deadline from gedf.rs to dag.rs as pub(crate), because the EDF scheduler and the DAG tests use it. - Remove the NOTE in invoke_preemption that described the GEDF policy. The EDF scheduler does not preempt when a core in the set is idle. - Rename test_clustered_edf to test_edf and remove test_gedf. Move test_dag, test_dvfs, and test_multi_prioritized_scheduler to SchedulerType::EDF. Signed-off-by: atsushi421 <[email protected]>
- Add test_global_edf, which checks that a CpuSet::all() EDF task preempts when every worker is busy and never runs on CPU 0. - Wake the primary CPU after the EDF scheduler enqueues a task, so re-wakes from do_preemption and run_main also wake an idle worker. - Make Dag::get_or_release_job private, because all callers are now in dag.rs. - Pass the task to ClusteredTask::new by value at its last use. Signed-off-by: atsushi421 <[email protected]>
This was referenced Nov 13, 2026
atsushi421
marked this pull request as ready for review
November 13, 2026 05:25
3 tasks done
romancardenas
approved these changes
Nov 13, 2026
romancardenas
left a comment
Contributor
There was a problem hiding this comment.
LGTM! I added two suggestions, but feel free to decline them.
atsushi421
added a commit
that referenced
this pull request
Nov 16, 2026
If an idle core of the set took the woken task, the previous commit skipped preemption. That rule judges only the woken task. It does not judge again a queued task that a later task pushes off the idle core. For example, take one idle core and two busy cores that run tasks with deadlines 50 and 40. If a task with deadline 12 wakes before a task with deadline 10, the rule queues both without preemption. The idle core takes the task with deadline 10, and the task with deadline 12 waits while the tasks with deadlines 50 and 40 run. If the sets differ, a rule that compares the queue length with the number of idle cores also fails. For example, cores 2 and 3 are idle, and the rule queues two tasks. Core 2 can take the one that core 3 can also run. Then the other task, whose set holds cores 1 and 2, waits behind a task with a later deadline on core 1. Now the scheduler ignores idle cores, as the GEDF scheduler did before PR #787. It chooses the victim among the busy cores of the set. If the woken task has a higher priority than the task on that core, the scheduler preempts it. If an idle core can take the task, the preemption is unneeded. But a sleeping core runs a queued task only after the primary CPU wakes it. With this rule, the preempted task waits for that wake instead of the woken task. If the set of a task holds one core, the behavior does not change. That set has no busy core while its core is idle. Signed-off-by: atsushi421 <[email protected]>
romancardenas
pushed a commit
that referenced
this pull request
Nov 16, 2026
If an idle core of the set took the woken task, the previous commit skipped preemption. That rule judges only the woken task. It does not judge again a queued task that a later task pushes off the idle core. For example, take one idle core and two busy cores that run tasks with deadlines 50 and 40. If a task with deadline 12 wakes before a task with deadline 10, the rule queues both without preemption. The idle core takes the task with deadline 10, and the task with deadline 12 waits while the tasks with deadlines 50 and 40 run. If the sets differ, a rule that compares the queue length with the number of idle cores also fails. For example, cores 2 and 3 are idle, and the rule queues two tasks. Core 2 can take the one that core 3 can also run. Then the other task, whose set holds cores 1 and 2, waits behind a task with a later deadline on core 1. Now the scheduler ignores idle cores, as the GEDF scheduler did before PR #787. It chooses the victim among the busy cores of the set. If the woken task has a higher priority than the task on that core, the scheduler preempts it. If an idle core can take the task, the preemption is unneeded. But a sleeping core runs a queued task only after the primary CPU wakes it. With this rule, the preempted task waits for that wake instead of the woken task. If the set of a task holds one core, the behavior does not change. That set has no busy core while its core is idle. Signed-off-by: atsushi421 <[email protected]>
1 task done
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
This PR merges GEDF into ClusteredEDF and renames the merged scheduler to EDF. GEDF is ClusteredEDF with every worker core in the CPU set, so one scheduler covers both.
API changes:
SchedulerType::GEDF(d). UseSchedulerType::EDF(d, CpuSet::all())instead.spawnremoves CPU 0 and out-of-range cores from the set without a warning. CPU 0 runs no tasks, so GEDF tasks never ran on it.SchedulerType::ClusteredEDF(d, set)becomesSchedulerType::EDF(d, set). A one-core set gives partitioned EDF.awkernel_async_lib::scheduler::gedf.calculate_and_update_dag_deadlinemoves todag.rsaspub(crate), because the EDF scheduler and the DAG unit tests call it.test_edfreplacestest_gedfandtest_clustered_edf.Other changes:
scheduler/clustered_edf.rsbecomesscheduler/edf.rs, andClusteredEDFSchedulerbecomesEDFScheduler.invoke_preemptionthat says the scheduler requests preemption regardless of the number of idle CPUs. The NOTE came from GEDF. If a core in the task's set is idle, the EDF scheduler does not preempt.test_clustered_edfbecomestest_edf. This PR removestest_gedf, because its expected result (light_1preemptsheavy_1) depends on the GEDF policy above.test_dag,test_dvfs, andtest_multi_prioritized_scheduleruseSchedulerType::EDF.test_edfaddstest_global_edf. It fills every worker core withCpuSet::all()tasks and checks that a task with an earlier deadline preempts one of them and that no task runs on CPU 0.do_preemptionandrun_maindo not go throughArcWake::wake, so before this change an idle worker in the set could stay asleep until the next loop of the primary CPU.Dag::get_or_release_jobbecomes private, because all its callers are indag.rs.docs/.Behavior changes for former GEDF tasks:
wake_workers()wakes every sleeping worker core. GEDF woke one sleeping core for each queued task. The extra cores find no task and sleep again. ClusteredEDF tasks with a large set already have this cost.BinaryHeapof GEDF did not define this order.Related links
How was this PR tested?
scripts/ci.shpasses on my machine.aarch64_virt, 4 CPUs),test_edflogs no[FAIL], andtest_global_edflogs[OK]. If the deadline of the urgent task is longer than the deadline of the fillers,test_global_edflogs[FAIL].test_dagruns, and every task oftest_multi_prioritized_schedulerstarts and finishes, with no panic.Notes for reviewers
Follow-up PRs stack on this PR in the order #788, #792, #789, #790. They change the idle-core rule of
invoke_preemption, fix the underflow ofNUM_TASK_IN_QUEUE, change the wake budget of global EDF tasks, and remove the clustered abstraction.This PR conflicts with #784 and #738, which change
scheduler/gedf.rsandSchedulerType::GEDF.If your local
Cargo.lockhas awkernel_sync from before tier4/awkernel_sync#1,test_dagon QEMU can hang. Runcargo update -p awkernel_syncbefore you test.