SchedClass

Enum SchedClass 

Source
pub enum SchedClass {
    Cfs,
    Batch,
    Idle,
    Rt,
    Deadline,
    Ext,
}
Expand description

Coarse Linux scheduling class identifier.

Maps to one of the kernel’s six core scheduler classes: fair_sched_class (CFS / EEVDF — covers SCHED_NORMAL, SCHED_BATCH, SCHED_IDLE), rt_sched_class (covers SCHED_FIFO and SCHED_RR), dl_sched_class (covers SCHED_DEADLINE), and ext_sched_class (covers SCHED_EXT when sched_ext is loaded). The class is a coarser concept than SchedPolicyCfs covers Normal/Batch/Idle, Rt covers Fifo/RoundRobin — and is what WorkType::AsymmetricWaker consumes when it wants to describe a waker / wakee pair without specifying priority values. When a per-worker class is applied, SchedClass::to_policy maps the variant to the equivalent SchedPolicy (using a default priority where applicable) and routes through set_sched_policy.

Variants§

§

Cfs

fair_sched_classSCHED_NORMAL (CFS / EEVDF). The default; matches a freshly-forked task before any policy override.

§

Batch

fair_sched_classSCHED_BATCH (background-friendly fair task with longer wakeup latency targets).

§

Idle

fair_sched_classSCHED_IDLE (lowest fair-class weight; runs only when nothing else is runnable).

§

Rt

rt_sched_classSCHED_FIFO at default priority RT_DEFAULT_PRIO. Requires CAP_SYS_NICE. For explicit priority control use SchedPolicy::Fifo directly.

§

Deadline

dl_sched_classSCHED_DEADLINE. Maps to a minimum-bandwidth deadline reservation (SchedClass::default_deadline_reservation) so SchedClass::Deadline is constructible without picking runtime/deadline/period. Callers needing precise reservations should use SchedPolicy::Deadline directly.

§

Ext

ext_sched_classSCHED_EXT. Routes the worker through the loaded sched_ext BPF scheduler. Under switch-all (the default scx-ktstr regime), this is the same effective class as Cfs because every fair-policy task already reroutes to ext via task_should_scx (see kernel/sched/ext.c). Cfs is preserved as the explicit “I want fair semantics” knob the user expresses; Ext maps to SchedPolicy::Ext, which sets policy == SCHED_EXT on the task_struct so it is BPF-scheduled even under a SCX_OPS_SWITCH_PARTIAL scheduler.

Implementations§

Source§

impl SchedClass

Source

pub const fn to_policy(self) -> SchedPolicy

Resolve to an equivalent SchedPolicy. Rt uses RT_DEFAULT_PRIO; Deadline uses the minimum-bandwidth reservation (2us runtime, 1ms deadline, 10ms period — passes __checkparam_dl and the default sysctl bounds). Ext maps to SchedPolicy::Ext, which issues sched_setattr with sched_policy = SCHED_EXT (7) so the kernel reads policy == SCHED_EXT. The task is BPF-scheduled only when a sched_ext scheduler is attached; with none attached the syscall still succeeds and the task runs in fair_sched_class.

Source

pub const fn default_deadline_reservation() -> SchedPolicy

Minimum-bandwidth SCHED_DEADLINE reservation that passes __checkparam_dl’s runtime >= (1 << DL_SCALE) (1024ns) floor and the kernel’s default sched_deadline_period_min_us (100us). 2us runtime, 1ms deadline, 10ms period — bandwidth fraction 0.0002, well below admission-control limits.

Trait Implementations§

Source§

impl Clone for SchedClass

Source§

fn clone(&self) -> SchedClass

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SchedClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SchedClass

Source§

fn default() -> SchedClass

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for SchedClass

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SchedClass

Source§

fn eq(&self, other: &SchedClass) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SchedClass

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for SchedClass

Source§

impl Eq for SchedClass

Source§

impl StructuralPartialEq for SchedClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,