#[non_exhaustive]pub struct SchedExtSysfs {
pub state: String,
pub switch_all: u64,
pub nr_rejected: u64,
pub hotplug_seq: u64,
pub enable_seq: u64,
}Expand description
Global sched_ext sysfs state, captured from
/sys/kernel/sched_ext/. The kernel registers exactly five
global attributes via scx_global_attrs[]
(kernel/sched/ext.c); this struct mirrors them
1-to-1.
Per-scheduler attrs (/sys/kernel/sched_ext/root/...) are
out of scope: those are scheduler-specific internals
(queued/dispatched/ops-name) that come and go as schedulers
load and unload, and answer different questions than the
global counters here.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.state: Stringstate — sched_ext class enable state. One of
enabling, enabled, disabling, disabled per
scx_enable_state_str[]
(kernel/sched/ext_internal.h). Emitted by
scx_attr_state_show()
(kernel/sched/ext.c). Defaults to empty string
when the file is unreadable; disabled when no scx
scheduler is currently loaded. The “is sched_ext active
during this capture?” answer.
switch_all: u64switch_all — boolean (rendered as 0/1) indicating
whether ALL scheduling classes have been switched to
scx (vs. only those tasks the BPF scheduler claims via
the per-task selection path). Emitted by
scx_attr_switch_all_show()
(kernel/sched/ext.c) via
READ_ONCE(scx_switching_all).
nr_rejected: u64nr_rejected — count of tasks rejected from
SCHED_EXT during init when ops.init_task() set
p->disallow. Increment in __scx_init_task()
(kernel/sched/ext.c): when a task entering
SCHED_EXT has its policy reverted to SCHED_NORMAL
because the BPF scheduler asked the kernel to disallow
it, atomic_long_inc(&scx_nr_rejected) fires.
atomic_long_read(&scx_nr_rejected) is emitted by
scx_attr_nr_rejected_show()
(kernel/sched/ext.c).
Resets to 0 on every scheduler load: scx_root_enable_workfn()
(kernel/sched/ext.c) does
atomic_long_set(&scx_nr_rejected, 0) before bringing
the new scheduler online. To detect a reload-driven
reset rather than a genuine cumulative drop, pair the
nr_rejected delta with Self::enable_seq — any
enable_seq movement across two snapshots invalidates
nr_rejected as a monotonic counter.
Does NOT count runtime dispatch errors. The “did the
scheduler reject a dispatch operation at runtime?”
question is answered by per-scheduler debug data
(/sys/kernel/sched_ext/root/...), out of scope for
this global-attrs struct.
hotplug_seq: u64hotplug_seq — per-CPU-hotplug-event sequence counter.
Atomic long incremented every time the kernel observes a
hotplug transition. Emitted by
scx_attr_hotplug_seq_show()
(kernel/sched/ext.c). Comparing two snapshots:
any delta indicates that a CPU online/offline event
happened during the interval, which can confound
per-CPU statistics.
enable_seq: u64enable_seq — per-scheduler-load sequence counter.
Atomic long incremented in scx_root_enable_workfn()
(kernel/sched/ext.c, atomic_long_inc(&scx_enable_seq))
each time a scx scheduler is enabled. Comparing two
snapshots: any delta indicates a scheduler reload
happened during the interval — counter resets on the
scx side will surface here even if the per-thread data
looks continuous.
Trait Implementations§
Source§impl Clone for SchedExtSysfs
impl Clone for SchedExtSysfs
Source§fn clone(&self) -> SchedExtSysfs
fn clone(&self) -> SchedExtSysfs
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SchedExtSysfs
impl Debug for SchedExtSysfs
Source§impl Default for SchedExtSysfs
impl Default for SchedExtSysfs
Source§fn default() -> SchedExtSysfs
fn default() -> SchedExtSysfs
Source§impl<'de> Deserialize<'de> for SchedExtSysfs
impl<'de> Deserialize<'de> for SchedExtSysfs
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for SchedExtSysfs
impl RefUnwindSafe for SchedExtSysfs
impl Send for SchedExtSysfs
impl Sync for SchedExtSysfs
impl Unpin for SchedExtSysfs
impl UnwindSafe for SchedExtSysfs
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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