Skip to main content

Module sched

Module sched 

Source
Expand description

Scheduling syscalls (SYS_SCHED_*, block 345-349).

Before this module, a userspace task could not change its policy, its priority or its CPU affinity: all three were fixed at creation from the silo configuration. The kernel already implements every scheduling class (SchedPolicy), so this is an exposure layer, not a scheduler rewrite.

Scope is deliberately limited to the calling task. Becoming real-time is gated on silo-admin capability until a dedicated scheduling capability resource exists (tracked as security work R11); dropping to Fair/Idle is always allowed so a task can never trap itself in an unschedulable state.

Re-exportsΒ§

use super::error::SyscallError; πŸ”’
use crate::memory::UserSliceWrite; πŸ”’
use crate::process::current_task_clone; πŸ”’
use crate::process::sched::nice::Nice; πŸ”’
use crate::process::sched::real_time::RealTimePriority; πŸ”’
use crate::process::sched::SchedPolicy; πŸ”’
use crate::process::set_task_sched_policy; πŸ”’
use crate::process::Task; πŸ”’
use crate::process::TaskPriority; πŸ”’
use strat9_abi::data::SchedInfo; πŸ”’
use strat9_abi::data::SCHED_INFO_FLAG_RT_DEGRADED; πŸ”’
use strat9_abi::syscall::SCHED_POLICY_FAIR; πŸ”’
use strat9_abi::syscall::SCHED_POLICY_FIFO; πŸ”’
use strat9_abi::syscall::SCHED_POLICY_IDLE; πŸ”’
use strat9_abi::syscall::SCHED_POLICY_RR; πŸ”’

FunctionsΒ§

decode_policy πŸ”’
Decode an ABI policy/priority pair into a kernel SchedPolicy.
encode_policy πŸ”’
Encode a kernel SchedPolicy back into the (policy, priority) wire representation used by SYS_SCHED_GET.
exceeds_priority_ceiling πŸ”’
Whether new gives more CPU entitlement than the task was created with.
online_cpu_mask πŸ”’
The mask of CPUs currently online, as a 64-bit affinity mask.
sys_sched_get
SYS_SCHED_GET(346): read the calling task’s policy and priority.
sys_sched_getaffinity
SYS_SCHED_GETAFFINITY(348): read the calling task’s soft CPU mask.
sys_sched_info
SYS_SCHED_INFO(349): fill a SchedInfo for the calling task.
sys_sched_set
SYS_SCHED_SET(345): change the calling task’s policy and priority.
sys_sched_setaffinity
SYS_SCHED_SETAFFINITY(347): replace the calling task’s soft CPU mask.