pub enum PagePolicy {
Resident,
LazyRowGranular,
OnDemand,
}Expand description
What the loader should do with a section’s pages.
This is the decision layer: a total, pure function of the access class, unit-testable with
no syscalls and no unsafe. Applying it — mmap plus the matching madvise — belongs to the
audited unsafe island in ftts-kernels, because ftts-artifacts is forbid(unsafe_code).
Keeping the two apart means the policy can be argued about and tested here, where getting it
wrong is cheap, rather than inside a syscall wrapper where it is not.
Variants§
Resident
Fault in eagerly and keep resident: MADV_WILLNEED.
Only for sections read every frame. The microdecoder pack is the whole reason this variant exists — it is reread 15× per frame and its residency is the project’s #1 design center.
LazyRowGranular
Map lazily and let the kernel fault pages in as they are touched, a row at a time.
Never MADV_WILLNEED. The text embedding is ~622 MB of which one synthesis touches a
few kilobytes; prefetching it wholesale would dominate startup and evict the very pages
PagePolicy::Resident exists to protect.
OnDemand
Map lazily, no advice. Enrollment sections a synthesis run never touches.
Implementations§
Source§impl PagePolicy
impl PagePolicy
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The stable wire string, for ftts inspect and the loader’s trace events.
Sourcepub const fn may_prefetch(self) -> bool
pub const fn may_prefetch(self) -> bool
Whether the loader may issue MADV_WILLNEED for this policy.
The single invariant the whole policy exists to enforce. Expressed as its own predicate so the syscall island can assert on it directly rather than re-deriving it from the class.
Trait Implementations§
Source§impl Clone for PagePolicy
impl Clone for PagePolicy
Source§fn clone(&self) -> PagePolicy
fn clone(&self) -> PagePolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more