pub struct CgroupMemoryController {
pub limit_hard: u64,
pub limit_soft: u64,
pub usage_current: u64,
pub usage_peak: u64,
pub stat: MemoryStat,
pub oom: OomEvent,
pub parent_id: u64,
pub cgroup_id: u64,
}Expand description
Cgroup memory controller.
Fields§
§limit_hard: u64Hard memory limit in bytes (0 = unlimited).
limit_soft: u64Soft memory limit in bytes (0 = unlimited).
usage_current: u64Current usage in bytes.
usage_peak: u64Peak (maximum) usage in bytes.
stat: MemoryStatDetailed memory statistics.
oom: OomEventOOM event state.
parent_id: u64Parent cgroup ID for hierarchical accounting (0 = root).
cgroup_id: u64Unique cgroup ID.
Implementations§
Source§impl CgroupMemoryController
impl CgroupMemoryController
pub fn new(cgroup_id: u64) -> Self
Sourcepub fn set_hard_limit(&mut self, limit: u64) -> Result<(), KernelError>
pub fn set_hard_limit(&mut self, limit: u64) -> Result<(), KernelError>
Set the hard limit. Returns error if current usage exceeds new limit.
Sourcepub fn set_soft_limit(&mut self, limit: u64)
pub fn set_soft_limit(&mut self, limit: u64)
Set the soft limit.
Sourcepub fn charge(&mut self, bytes: u64) -> Result<(), KernelError>
pub fn charge(&mut self, bytes: u64) -> Result<(), KernelError>
Charge memory usage. Returns error if hard limit would be exceeded.
Sourcepub fn soft_limit_exceeded(&self) -> bool
pub fn soft_limit_exceeded(&self) -> bool
Check if soft limit is exceeded (triggers reclaim pressure).
Sourcepub fn add_mapped_file(&mut self, bytes: u64)
pub fn add_mapped_file(&mut self, bytes: u64)
Record a mapped file addition.
Sourcepub fn hierarchical_usage(&self) -> u64
pub fn hierarchical_usage(&self) -> u64
Hierarchical usage including parent chain (simplified: just self).
Trait Implementations§
Source§impl Clone for CgroupMemoryController
impl Clone for CgroupMemoryController
Source§fn clone(&self) -> CgroupMemoryController
fn clone(&self) -> CgroupMemoryController
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CgroupMemoryController
impl RefUnwindSafe for CgroupMemoryController
impl Send for CgroupMemoryController
impl Sync for CgroupMemoryController
impl Unpin for CgroupMemoryController
impl UnwindSafe for CgroupMemoryController
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)