Skip to content

Conversation

tsoutsman
Copy link
Member

@tsoutsman tsoutsman commented Jun 19, 2023

Depends on #980 and #981.

Moves state_transfer to old_crates because it no longer compiles and would need to be reworked, but it wasn't functional in the first place.

The short of it is that our priority scheduler isn't actually a priority
scheduler.

I initially made a large PR with a bunch of scheduler changes but
realised that because of all the renaming, file history was lost, so
I've split the PR into a bunch of smaller PRs.

After this is merged I'll create a PR to rename `scheduler_realtime` to
`scheduler_priority`.

Signed-off-by: Klimenty Tsoutsman <[email protected]>
Depends on theseus-os#980.

The realtime scheduler doesn't actually implement rate monotonic
scheduling as the period is just used as a glorified inverse priority.

Next steps in the scheduler saga:
- Allow changing scheduler policy live
- Merge `set_priority` and `set_periodicity` (as the periodicity isn't
  properly used)
- Merge scheduler and run queue crates (pending discussion on Discord)
- Update docs to better explain crates, particularly `scheduler_epoch`

I've implemented some of these and will open a PR once theseus-os#980 and theseus-os#981 are
merged.

Signed-off-by: Klimenty Tsoutsman <[email protected]>
Signed-off-by: Klimenty Tsoutsman <[email protected]>
@tsoutsman tsoutsman requested a review from kevinaboos June 23, 2023 00:36
Signed-off-by: Klimenty Tsoutsman <[email protected]>
Copy link
Member

@kevinaboos kevinaboos left a comment

Choose a reason for hiding this comment

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

Looks good!

Regarding the "TODO"s/questions you left, I think it's probably best to continue to return an Option<TaskRef> from select_next_task(), and then have the schedule() function select an idle task independently of the runqueue. This goes hand-in-hand with another change we can make, which is to move the idle task into CPU-local storage, since it "belongs" a CPU instance rather than a runqueue instance. This also makes the runqueue design have fewer concerns and also more flexible, since we may not always want to create exactly one runqueue per CPU.

I'll likely make some of those changes later, or you can do it as part of your series of scheduler PRs; your call.

@kevinaboos kevinaboos merged commit 18dc5f5 into theseus-os:theseus_main Jun 23, 2023
github-actions bot pushed a commit that referenced this pull request Jun 23, 2023
* As part of our ongoing scheduler/runqueue redesign,
  there is no real reason to store each CPU's idle task
  in a scheduler runqueue. They are only used separately
  as a "last resort" when no runnable tasks exist, so we
  can store them alongside the runqueue rather than inside it.

* Also, we change the creation of idle tasks to be done
  as part of initializing the tasking subsystem on each CPU
  rather than as an explicit step in the captain's init routine.

* In the future, each CPU's idle task can be stored in
  CPU-local storage, since they ideologically "belong" to
  a CPU instance rather than a runqueue instance.

* Unrelated: move `state_transfer` to old crates, as it
  currently doesn't build any more due to the ongoing
  scheduler/runqueue changes.

Signed-off-by: Klimenty Tsoutsman <[email protected]> 18dc5f5
github-actions bot pushed a commit to tsoutsman/Theseus that referenced this pull request Jun 23, 2023
* As part of our ongoing scheduler/runqueue redesign,
  there is no real reason to store each CPU's idle task
  in a scheduler runqueue. They are only used separately
  as a "last resort" when no runnable tasks exist, so we
  can store them alongside the runqueue rather than inside it.

* Also, we change the creation of idle tasks to be done
  as part of initializing the tasking subsystem on each CPU
  rather than as an explicit step in the captain's init routine.

* In the future, each CPU's idle task can be stored in
  CPU-local storage, since they ideologically "belong" to
  a CPU instance rather than a runqueue instance.

* Unrelated: move `state_transfer` to old crates, as it
  currently doesn't build any more due to the ongoing
  scheduler/runqueue changes.

Signed-off-by: Klimenty Tsoutsman <[email protected]> 18dc5f5
@kevinaboos kevinaboos mentioned this pull request Oct 3, 2023
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