pub struct ResidencyPlan { /* private fields */ }Expand description
The residency labels a bank load asked for, and the ones it got.
The loader walks layers, calls settle_action
for each, does the syscall itself, and reports back with
record / record_lock.
Nothing here touches memory: this side owns the bookkeeping, the
caller owns the syscall. achieved_labels
is what then feeds BankResidency::new – the achieved labels,
never the requested ones.
Implementations§
Source§impl ResidencyPlan
impl ResidencyPlan
pub fn new(requested: Vec<HostResidency>) -> Self
Sourcepub fn all_pinned(num_layers: usize) -> Self
pub fn all_pinned(num_layers: usize) -> Self
The no-split plan: every layer pinned, which is what a host with no pin cap always does.
pub fn num_layers(&self) -> usize
Sourcepub fn has_unpinned(&self) -> bool
pub fn has_unpinned(&self) -> bool
Whether any layer was asked to be something other than pinned. A plan with none of them is indistinguishable from no plan.
Sourcepub fn applied(&self) -> bool
pub fn applied(&self) -> bool
Whether any settle point consulted this plan.
A loader that pins everything by construction never asks, and its banks are all pinned no matter what was requested. That is still a working load – CPU-layer decode reads a pinned bank perfectly well – it just saved no pin quota, so the honest report is “not applied”, not the labels that were wished for.
Sourcepub fn lock_quota_exhausted(&self) -> bool
pub fn lock_quota_exhausted(&self) -> bool
Whether a lock has already failed.
The OS lock ceiling is a per-process quota, so once one request is over it every later (larger cumulative) request is too. Sticky, therefore, rather than retried per bank: retrying buys nothing and turns one failure into one failed syscall per bank for the rest of the load.
Sourcepub fn requested(&self, layer_id: usize) -> HostResidency
pub fn requested(&self, layer_id: usize) -> HostResidency
Sourcepub fn settle_action(&mut self, layer_id: usize) -> SettleAction
pub fn settle_action(&mut self, layer_id: usize) -> SettleAction
What to do with layer layer_id’s freshly filled bank, marking
the plan applied.
Returns SettleAction::LeavePageable for a Locked layer
once the lock quota is known to be exhausted – the syscall
would fail anyway, and the bank ends up pageable either way.
§Panics
If layer_id is not a layer of this plan.
Sourcepub fn record(&mut self, layer_id: usize, achieved: HostResidency)
pub fn record(&mut self, layer_id: usize, achieved: HostResidency)
Record what one of layer layer_id’s banks actually settled at.
A layer is several banks and is only as resident as its worst
one, so once a layer has recorded HostResidency::Pageable no
later, better, report can raise it again.
§Panics
If layer_id is not a layer of this plan.
Sourcepub fn record_lock(&mut self, layer_id: usize, locked: bool)
pub fn record_lock(&mut self, layer_id: usize, locked: bool)
Record the outcome of one lock attempt: locked false means the
bank is pageable and the quota is spent for the rest of the
load.
§Panics
If layer_id is not a layer of this plan.
Sourcepub fn achieved(&self, layer_id: usize) -> Option<HostResidency>
pub fn achieved(&self, layer_id: usize) -> Option<HostResidency>
Sourcepub fn achieved_labels(&self) -> Vec<HostResidency>
pub fn achieved_labels(&self) -> Vec<HostResidency>
The labels to hand BankResidency::new: what was achieved
where anything reported, what was requested elsewhere.
A pinned layer never reports, because a failed pin is a hard error the loader raises rather than a downgrade – there is no second way to serve a GPU layer.
Sourcepub fn downgraded(&self) -> Vec<u32>
pub fn downgraded(&self) -> Vec<u32>
The layers that did not get what they asked for, for the one warning a human needs to see: they still decode on the CPU executor, but they may now swap under memory pressure.
Trait Implementations§
Source§impl Clone for ResidencyPlan
impl Clone for ResidencyPlan
Source§fn clone(&self) -> ResidencyPlan
fn clone(&self) -> ResidencyPlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResidencyPlan
impl Debug for ResidencyPlan
impl Eq for ResidencyPlan
Source§impl PartialEq for ResidencyPlan
impl PartialEq for ResidencyPlan
impl StructuralPartialEq for ResidencyPlan
Auto Trait Implementations§
impl Freeze for ResidencyPlan
impl RefUnwindSafe for ResidencyPlan
impl Send for ResidencyPlan
impl Sync for ResidencyPlan
impl Unpin for ResidencyPlan
impl UnsafeUnpin for ResidencyPlan
impl UnwindSafe for ResidencyPlan
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,
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