pub struct GlobalSchedState { /* private fields */ }Expand description
Global task registry : cold path: fork, exit, all_tasks scan.
Lock order: acquire GLOBAL_SCHED_STATE before LOCAL when both are needed.
Per-CPU runqueues and current-task tracking live in LOCAL_SCHEDULERS.
Blocked tasks are tracked in BLOCKED_TASKS (separate lock).
Identity maps (PID/TID, pgid, sid, parent/child) are in SCHED_IDENTITY (separate lock).
This struct holds only data that is accessed by cold paths (fork, exit,
all_tasks scan, zombie management, wake deadlines) and is protected by the
GLOBAL_SCHED_STATE lock.
Implementations§
Source§impl GlobalSchedState
impl GlobalSchedState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new global scheduler state (no per-CPU runqueues : those live in LOCAL_SCHEDULERS).
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.
NOTE: blocked_tasks lives in the separate BLOCKED_TASKS lock.
This method now only handles the fallback path (task not yet blocked,
set wake_pending). The primary wake path is in wake_task().
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.
If target is Some(tid), only reaps that child; otherwise, reaps any child.
Returns WaitChildResult indicating the outcome.
Must be called with the scheduler lock held.
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 GlobalSchedState
impl !RefUnwindSafe for GlobalSchedState
impl Send for GlobalSchedState
impl Sync for GlobalSchedState
impl Unpin for GlobalSchedState
impl UnsafeUnpin for GlobalSchedState
impl !UnwindSafe for GlobalSchedState
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
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>
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>
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