#[non_exhaustive]pub struct CgroupMemoryStats {
pub current: u64,
pub max: Option<u64>,
pub high: Option<u64>,
pub low: Option<u64>,
pub min: Option<u64>,
pub stat: BTreeMap<String, u64>,
pub events: BTreeMap<String, u64>,
}Expand description
Memory controller state for one cgroup. Fields mirror the
memory.* cgroup v2 files. stat and events are
captured as flat key-value maps so the data model
auto-extends when the kernel adds new keys (memory.stat
has 71 keys on a recent kernel; the explicit list is
scheduler-correctness-relevant but the map preserves
regression-detection on lesser-known counters).
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.current: u64memory.current, instantaneous RSS of the cgroup in
bytes.
max: Option<u64>memory.max, hard memory limit in bytes. None when
the file is absent (root cgroup) OR when the kernel
emits the literal “max” token (no hard cap).
high: Option<u64>memory.high, soft pressure limit in bytes. None when
absent or unlimited (same “max”-token semantics as
Self::max).
low: Option<u64>memory.low, best-effort protection floor in bytes.
None when the file is absent (no protection
configured); Some(u64::MAX) when the kernel emits the
literal max token (request maximum protection — every
byte under the cgroup is protected). Per the kernel’s
cgroup v2 docs, memory under low is protected from
reclaim unless no unprotected memory remains. Note the
asymmetry vs. limits: None means “no floor” (semantic
opposite of “max”-as-no-cap on the limit fields above).
min: Option<u64>memory.min, hard protection floor in bytes. None
when absent (no floor). Some(u64::MAX) when the kernel
emits max (full protection). Stronger than low —
memory under min is never reclaimed even under
memory pressure.
stat: BTreeMap<String, u64>memory.stat parsed as a key-value map. Keys mirror the
kernel-emitted strings (e.g. anon, file,
workingset_refault_anon, pgfault, pgmajfault,
slab, the active/inactive variants, etc.). Empty when
the file is absent.
events: BTreeMap<String, u64>memory.events parsed as a key-value map. Typical keys:
low, high, max, oom, oom_kill,
oom_group_kill, sock_throttled (subset varies by
kernel version). Empty when the file is absent.
Trait Implementations§
Source§impl Clone for CgroupMemoryStats
impl Clone for CgroupMemoryStats
Source§fn clone(&self) -> CgroupMemoryStats
fn clone(&self) -> CgroupMemoryStats
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CgroupMemoryStats
impl Debug for CgroupMemoryStats
Source§impl Default for CgroupMemoryStats
impl Default for CgroupMemoryStats
Source§fn default() -> CgroupMemoryStats
fn default() -> CgroupMemoryStats
Source§impl<'de> Deserialize<'de> for CgroupMemoryStats
impl<'de> Deserialize<'de> for CgroupMemoryStats
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 CgroupMemoryStats
impl RefUnwindSafe for CgroupMemoryStats
impl Send for CgroupMemoryStats
impl Sync for CgroupMemoryStats
impl Unpin for CgroupMemoryStats
impl UnwindSafe for CgroupMemoryStats
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