pub struct Scheduler { /* private fields */ }Expand description
The round-robin scheduler (per-CPU queues)
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn add_task_with_parent(
&mut self,
task: Arc<Task>,
parent: TaskId,
) -> Option<usize>
pub fn add_task_with_parent( &mut self, task: Arc<Task>, parent: TaskId, ) -> Option<usize>
Performs the add task with parent operation.
Sourcepub fn clear_task_wake_deadline_locked(&mut self, id: TaskId) -> bool
pub fn clear_task_wake_deadline_locked(&mut self, id: TaskId) -> bool
Performs the clear task wake deadline locked operation.
Sourcepub fn set_task_wake_deadline_locked(
&mut self,
id: TaskId,
deadline: u64,
) -> bool
pub fn set_task_wake_deadline_locked( &mut self, id: TaskId, deadline: u64, ) -> bool
Sets task wake deadline locked.
Sourcepub fn wake_task_locked(&mut self, id: TaskId) -> (bool, Option<usize>)
pub fn wake_task_locked(&mut self, id: TaskId) -> (bool, Option<usize>)
Performs the wake task locked operation.
Returns (was_woken, ipi_cpu). The caller must send a resched IPI to
ipi_cpu after releasing the scheduler lock.
Sourcepub fn try_reap_child_locked(
&mut self,
parent: TaskId,
target: Option<TaskId>,
) -> WaitChildResult
pub fn try_reap_child_locked( &mut self, parent: TaskId, target: Option<TaskId>, ) -> WaitChildResult
Attempts to reap child locked.
Sourcepub fn pick_next_task(&mut self, cpu_index: usize) -> Arc<Task>
pub fn pick_next_task(&mut self, cpu_index: usize) -> Arc<Task>
Pick the next task to run on cpu_index.
- Re-queues the current Running task (round-robin). The idle task is never re-queued — it is always available as the last-resort fallback. Keeping it out of the ready queue ensures the queue becomes truly empty when there is no real work, which lets work-stealing kick in on other CPUs.
- Pops from the local ready queue.
- Falls back to work-stealing from the busiest other CPU.
- Falls back to the per-CPU idle task.
Sourcepub fn steal_task(&mut self, dst_cpu: usize, now_tick: u64) -> Option<Arc<Task>>
pub fn steal_task(&mut self, dst_cpu: usize, now_tick: u64) -> Option<Arc<Task>>
Try to steal one task from the most-loaded other CPU.
We steal from the back of the source queue (the task added most recently — least likely to have warm cache data on that CPU). We only steal when the source has ≥ 2 tasks, so it keeps at least one.
Sourcepub fn migrate_ready_tasks_for_new_class_table(&mut self)
pub fn migrate_ready_tasks_for_new_class_table(&mut self)
Performs the migrate ready tasks for new class table operation.
Auto Trait Implementations§
impl Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
impl !UnwindSafe for Scheduler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more