#[non_exhaustive]pub struct ArenaSnapshot {
pub pages: Vec<ArenaPage>,
pub truncated: bool,
pub declared_pages: u64,
pub span_capped: bool,
pub kern_vm_start: u64,
pub user_vm_start: u64,
}Expand description
Snapshot of one arena map’s mapped pages.
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.pages: Vec<ArenaPage>Mapped pages, in pgoff order (skipped over unmapped pgoffs).
Sequential prefix (pgoffs 0..MAX_ARENA_PAGES) followed by any
stride-probe hits in the sparse tail (pgoffs sampled across
MAX_ARENA_PAGES..declared_pages).
truncated: boolTrue when the walker stopped sequential enumeration at
MAX_ARENA_PAGES before finishing the user_vm window. The
stride sweep that follows samples the tail at coarse intervals,
so a hit reaches pages even when this flag is set; pgoffs
between sampled positions are still silently skipped.
declared_pages: u64Total declared page count. Derived from
max_entries * page_size (the BPF map’s declared page
capacity, with page_size resolved from the guest’s
TCR_EL1 via guest_page_size), not the user_vm window.
Reflects any MAX_VM_RANGE_BYTES cap. Surfaced alongside
pages.len() so consumers can see the
allocated-vs-declared ratio.
span_capped: boolTrue when max_entries * page_size exceeded
MAX_VM_RANGE_BYTES (4 GiB) and the walker capped the span
before computing declared_pages. Indicates a torn / corrupt
bpf_arena struct or a freeze-time race against initialization;
the rendered pages still come from valid translates, so the
snapshot is usable.
kern_vm_start: u64Kernel-side base of the arena’s user_vm window:
bpf_arena.kern_vm->addr + GUARD_HALF. Surfaces here so
downstream consumers (notably the super::sdt_alloc tree
walker) can translate __arena pointers without re-reading
struct bpf_arena themselves. 0 when the snapshot bailed
before computing the value (kern_vm_kva NULL, vm_addr NULL,
or any of the upstream translates failed).
Always serialized — the zero value carries diagnostic
information (“walker reached this point but couldn’t compute
the base”), so suppressing it would mask the failure. Mirrors
the policy used for the sibling declared_pages field.
user_vm_start: u64User-side base of the arena window: the value of
bpf_arena.user_vm_start, the address space the BPF program
(and any captured __arena pointer) sees. [user_vm_start .. user_vm_start + 4 GiB) is the kernel-enforced upper bound
(bpf_arena_alloc_pages clamps to SZ_4G). Consumers use it
to classify a pointer as “lives in this arena” before chasing
into Self::pages.
0 when the snapshot bailed before reading
arena.user_vm_start (e.g. arena_pa translate failed). On
the syscall backend this comes from bpf_map.map_extra which
the kernel pins at create time (lib/arena_map.h hardcodes
1<<44 on x86, 1<<32 on aarch64). On the guest-memory
backend it’s read directly from
bpf_arena.user_vm_start via the resolved offset.
Always serialized for the same diagnostic reason as
Self::kern_vm_start.
Trait Implementations§
Source§impl Clone for ArenaSnapshot
impl Clone for ArenaSnapshot
Source§fn clone(&self) -> ArenaSnapshot
fn clone(&self) -> ArenaSnapshot
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArenaSnapshot
impl Debug for ArenaSnapshot
Source§impl Default for ArenaSnapshot
impl Default for ArenaSnapshot
Source§fn default() -> ArenaSnapshot
fn default() -> ArenaSnapshot
Source§impl<'de> Deserialize<'de> for ArenaSnapshot
impl<'de> Deserialize<'de> for ArenaSnapshot
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 ArenaSnapshot
impl RefUnwindSafe for ArenaSnapshot
impl Send for ArenaSnapshot
impl Sync for ArenaSnapshot
impl Unpin for ArenaSnapshot
impl UnwindSafe for ArenaSnapshot
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