Opts

Struct Opts 

Source
pub(crate) struct Opts {
Show 30 fields pub(crate) verbose: u8, pub(crate) autopilot: bool, pub(crate) autopower: bool, pub(crate) performance: bool, pub(crate) powersave: bool, pub(crate) balanced: bool, pub(crate) slice_max_us: u64, pub(crate) slice_min_us: u64, pub(crate) mig_delta_pct: u8, pub(crate) pinned_slice_us: Option<u64>, pub(crate) preempt_shift: u8, pub(crate) cpu_pref_order: String, pub(crate) no_use_em: bool, pub(crate) no_futex_boost: bool, pub(crate) no_preemption: bool, pub(crate) no_wake_sync: bool, pub(crate) no_slice_boost: bool, pub(crate) per_cpu_dsq: bool, pub(crate) enable_cpu_bw: bool, pub(crate) no_core_compaction: bool, pub(crate) no_freq_scaling: bool, pub(crate) stats: Option<f64>, pub(crate) monitor: Option<f64>, pub(crate) monitor_sched_samples: Option<u64>, pub(crate) log_level: String, pub(crate) version: bool, pub(crate) run_id: Option<u64>, pub(crate) help_stats: bool, pub libbpf: LibbpfOpts, pub(crate) topology: Option<TopologyArgs>,
}
Expand description

scx_lavd: Latency-criticality Aware Virtual Deadline (LAVD) scheduler

The rust part is minimal. It processes command line options and logs out scheduling statistics. The BPF part makes all the scheduling decisions. See the more detailed overview of the LAVD design at main.bpf.c.

Fields§

§verbose: u8

Depricated, noop, use RUST_LOG or –log-level instead.

§autopilot: bool

Automatically decide the scheduler’s power mode (performance vs. powersave vs. balanced), CPU preference order, etc, based on system load. The options affecting the power mode and the use of core compaction (–autopower, –performance, –powersave, –balanced, –no-core-compaction) cannot be used with this option. When no option is specified, this is a default mode.

§autopower: bool

Automatically decide the scheduler’s power mode (performance vs. powersave vs. balanced) based on the system’s active power profile. The scheduler’s power mode decides the CPU preference order and the use of core compaction, so the options affecting these (–autopilot, –performance, –powersave, –balanced, –no-core-compaction) cannot be used with this option.

§performance: bool

Run the scheduler in performance mode to get maximum performance. This option cannot be used with other conflicting options (–autopilot, –autopower, –balanced, –powersave, –no-core-compaction) affecting the use of core compaction.

§powersave: bool

Run the scheduler in powersave mode to minimize powr consumption. This option cannot be used with other conflicting options (–autopilot, –autopower, –performance, –balanced, –no-core-compaction) affecting the use of core compaction.

§balanced: bool

Run the scheduler in balanced mode aiming for sweetspot between power and performance. This option cannot be used with other conflicting options (–autopilot, –autopower, –performance, –powersave, –no-core-compaction) affecting the use of core compaction.

§slice_max_us: u64

Maximum scheduling slice duration in microseconds.

§slice_min_us: u64

Minimum scheduling slice duration in microseconds.

§mig_delta_pct: u8

Migration delta threshold percentage (0-100). When set to a non-zero value, uses average utilization for threshold calculation instead of current utilization, and the threshold is calculated as: avg_load * (mig-delta-pct / 100). Additionally, disables force task stealing in the consume path, relying only on the is_stealer/is_stealee thresholds for more predictable load balancing. Default is 0 (disabled, uses dynamic threshold based on load with both probabilistic and force task stealing enabled). This is an experimental feature.

§pinned_slice_us: Option<u64>

Slice duration in microseconds to use for all tasks when pinned tasks are running on a CPU. Must be between slice-min-us and slice-max-us. When this option is enabled, pinned tasks are always enqueued to per-CPU DSQs and the dispatch logic compares vtimes across all DSQs to select the lowest vtime task. This helps improve responsiveness for pinned tasks. By default, this option is on with a default value of 5000 (5 msec). To turn off the option, explicitly set the value to 0.

§preempt_shift: u8

Limit the ratio of preemption to the roughly top P% of latency-critical tasks. When N is given as an argument, P is 0.5^N * 100. The default value is 6, which limits the preemption for the top 1.56% of latency-critical tasks.

§cpu_pref_order: String

List of CPUs in preferred order (e.g., “0-3,7,6,5,4”). The scheduler uses the CPU preference mode only when the core compaction is enabled (i.e., balanced or powersave mode is specified as an option or chosen in the autopilot or autopower mode). When “–cpu-pref-order” is given, it implies “–no-use-em”.

§no_use_em: bool

Do not use the energy model in making CPU preference order decisions.

§no_futex_boost: bool

Do not boost futex holders.

§no_preemption: bool

Disable preemption.

§no_wake_sync: bool

Disable an optimization for synchronous wake-up.

§no_slice_boost: bool

Disable dynamic slice boost for long-running tasks.

§per_cpu_dsq: bool

Enables DSQs per CPU, this enables task queuing and dispatching from CPU specific DSQs. This generally increases L1/L2 cache locality for tasks and lowers lock contention compared to shared DSQs, but at the cost of higher load balancing complexity. This is a highly experimental feature.

§enable_cpu_bw: bool

Enable CPU bandwidth control using cpu.max in cgroup v2. This is a highly experimental feature.

§no_core_compaction: bool

Disable core compaction so the scheduler uses all the online CPUs. The core compaction attempts to minimize the number of actively used CPUs for unaffinitized tasks, respecting the CPU preference order. Normally, the core compaction is enabled by the power mode (i.e., balanced or powersave mode is specified as an option or chosen in the autopilot or autopower mode). This option cannot be used with the other options that control the core compaction (–autopilot, –autopower, –performance, –balanced, –powersave).

§no_freq_scaling: bool

Disable controlling the CPU frequency.

§stats: Option<f64>

Enable stats monitoring with the specified interval.

§monitor: Option<f64>

Run in stats monitoring mode with the specified interval. Scheduler is not launched.

§monitor_sched_samples: Option<u64>

Run in monitoring mode. Show the specified number of scheduling samples every second.

§log_level: String

Specify the logging level. Accepts rust’s envfilter syntax for modular logging: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#example-syntax. Examples: [“info”, “warn,tokio=info”]

§version: bool

Print scheduler version and exit.

§run_id: Option<u64>

Optional run ID for tracking scheduler instances.

§help_stats: bool

Show descriptions for statistics.

§libbpf: LibbpfOpts§topology: Option<TopologyArgs>

Topology configuration options

Implementations§

Source§

impl Opts

Source

pub(crate) fn can_autopilot(&self) -> bool

Source

pub(crate) fn can_autopower(&self) -> bool

Source

pub(crate) fn can_performance(&self) -> bool

Source

pub(crate) fn can_balanced(&self) -> bool

Source

pub(crate) fn can_powersave(&self) -> bool

Source

pub(crate) fn proc(&mut self) -> Option<&mut Self>

Source

pub(crate) fn preempt_shift_range(s: &str) -> Result<u8, String>

Source

pub(crate) fn mig_delta_pct_range(s: &str) -> Result<u8, String>

Trait Implementations§

Source§

impl Args for Opts

Source§

fn group_id() -> Option<Id>

Report the [ArgGroup::id][crate::ArgGroup::id] for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate Self via [FromArgMatches::from_arg_matches_mut] Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to [Command] so it can instantiate self via [FromArgMatches::update_from_arg_matches_mut] Read more
Source§

impl CommandFactory for Opts

Source§

fn command<'b>() -> Command

Build a [Command] that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a [Command] that can update self. Read more
Source§

impl Debug for Opts

Source§

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

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

impl FromArgMatches for Opts

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from [ArgMatches], parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Opts

§

fn parse() -> Self

Parse from std::env::args_os(), [exit][Error::exit] on error.
§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, [exit][Error::exit] on error.
§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, [exit][Error::exit] on error. Read more
§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Opts

§

impl RefUnwindSafe for Opts

§

impl Send for Opts

§

impl Sync for Opts

§

impl Unpin for Opts

§

impl UnwindSafe for Opts

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> Conv for T

§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
§

impl<T> FmtForward for T

§

fn fmt_binary(self) -> FmtBinary<Self>
where Self: Binary,

Causes self to use its Binary implementation when Debug-formatted.
§

fn fmt_display(self) -> FmtDisplay<Self>
where Self: Display,

Causes self to use its Display implementation when Debug-formatted.
§

fn fmt_lower_exp(self) -> FmtLowerExp<Self>
where Self: LowerExp,

Causes self to use its LowerExp implementation when Debug-formatted.
§

fn fmt_lower_hex(self) -> FmtLowerHex<Self>
where Self: LowerHex,

Causes self to use its LowerHex implementation when Debug-formatted.
§

fn fmt_octal(self) -> FmtOctal<Self>
where Self: Octal,

Causes self to use its Octal implementation when Debug-formatted.
§

fn fmt_pointer(self) -> FmtPointer<Self>
where Self: Pointer,

Causes self to use its Pointer implementation when Debug-formatted.
§

fn fmt_upper_exp(self) -> FmtUpperExp<Self>
where Self: UpperExp,

Causes self to use its UpperExp implementation when Debug-formatted.
§

fn fmt_upper_hex(self) -> FmtUpperHex<Self>
where Self: UpperHex,

Causes self to use its UpperHex implementation when Debug-formatted.
§

fn fmt_list(self) -> FmtList<Self>
where &'a Self: for<'a> IntoIterator,

Formats each item in a sequence. Read more
§

impl<T> From<T> for T

§

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
§

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

§

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> Pipe for T
where T: ?Sized,

§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
§

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> Tap for T

§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
§

impl<T> TryConv for T

§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.
§

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