STRA-338 size: model-format: wrap long comments and format strings to 120 columns (width 69->0)
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
/// Read `file[start .. start + len]` in blocks on several threads and hand each block to `sink(absolute_offset, bytes)`.
|
||||
/// Read `file[start .. start + len]` in blocks on several threads and hand each block to `sink(absolute_offset,
|
||||
/// bytes)`.
|
||||
/// Blocks arrive in no particular order, from different threads; each covers a distinct range of at most `plan.chunk`
|
||||
/// bytes. The first error stops the others and is returned.
|
||||
pub fn for_each_chunk<F>(file: &File, start: u64, len: u64, plan: Plan, sink: F) -> io::Result<Report>
|
||||
@@ -17,7 +18,8 @@ where
|
||||
if len == 0 {
|
||||
return Ok(Report { strategy, bytes: 0, elapsed: began.elapsed() });
|
||||
}
|
||||
// The block that reaches the file's last bytes may be shorter than its aligned length: `read_full` stops at the end.
|
||||
// The block that reaches the file's last bytes may be shorter than its aligned length: `read_full` stops at the
|
||||
// end.
|
||||
let threads = plan.threads.clamp(1, len.div_ceil(chunk) as usize);
|
||||
let mut buffers = aligned_buffers(threads, chunk as usize + 2 * ALIGN)?;
|
||||
let mut shared = Shared::new(file, (strategy, direct), (start, len, file_len, chunk), plan.ahead, &sink);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Strategy, impl Plan, impl Default_for_Plan, impl Report, impl Aligned, fn open_direct ....
|
||||
//! Moved out of the parent module by STRA-338: impl Strategy, impl Plan, impl Default_for_Plan, impl Report, impl
|
||||
//! Aligned, fn open_direct ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
@@ -15,7 +16,8 @@ impl Strategy {
|
||||
|
||||
impl Plan {
|
||||
/// The defaults, then the environment (`LELEKA_LOAD_READ=direct|advise|plain`, `LELEKA_LOAD_THREADS=N`,
|
||||
/// `LELEKA_LOAD_CHUNK_MIB=N`, `LELEKA_LOAD_AHEAD_MIB=N`): the switches that let one binary be measured in each form.
|
||||
/// `LELEKA_LOAD_CHUNK_MIB=N`, `LELEKA_LOAD_AHEAD_MIB=N`): the switches that let one binary be measured in each
|
||||
/// form.
|
||||
pub fn from_env() -> Plan {
|
||||
Plan::with_overrides(Plan::default(), |name| std::env::var(name).ok())
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn parse_artifact_digest, fn sha256_pipelined, fn stream_file_span, fn read_file_span_owned, fn read_file_span_into, fn check_flash_next_profile ....
|
||||
//! Moved out of the parent module by STRA-338: fn parse_artifact_digest, fn sha256_pipelined, fn stream_file_span, fn
|
||||
//! read_file_span_owned, fn read_file_span_into, fn check_flash_next_profile ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn read_metadata_snapshot_with_architecture, fn validate_tokenizer_metadata, fn inspect, fn tensor_index, fn tensor_sha256, fn read_index.
|
||||
//! Moved out of the parent module by STRA-338: fn read_metadata_snapshot_with_architecture, fn
|
||||
//! validate_tokenizer_metadata, fn inspect, fn tensor_index, fn tensor_sha256, fn read_index.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn stream_buffer_bytes, fn stream_buffer_bytes, fn with_test_stream_buffer.
|
||||
//! Moved out of the parent module by STRA-338: fn stream_buffer_bytes, fn stream_buffer_bytes, fn
|
||||
//! with_test_stream_buffer.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): admits_flash_metadata_and_rejects_incompatible_profiles, inspects_header_and_rejects_truncated_payload, indexes_exact_mixed_tensor_spans_and_rejects_bad_layouts, owned_handle_verifies_artifact_and_streams_exact_tensor_bytes_with_bounded_chunks ....
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338):
|
||||
//! admits_flash_metadata_and_rejects_incompatible_profiles, inspects_header_and_rejects_truncated_payload,
|
||||
//! indexes_exact_mixed_tensor_spans_and_rejects_bad_layouts,
|
||||
//! owned_handle_verifies_artifact_and_streams_exact_tensor_bytes_with_bounded_chunks ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): buffered_cursor_preserves_offsets_parsing_and_refusals_with_bounded_reads.
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338):
|
||||
//! buffered_cursor_preserves_offsets_parsing_and_refusals_with_bounded_reads.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): empty_owned_tensor_validation_preserves_cursor_bounds_and_size_checks, owned_tensor_bounds_are_checked_before_any_callback_and_stream_can_recover, pathname_replacement_keeps_original_verified_file_and_index, opened_file_size_changes_are_refused_and_same_size_mutation_is_not_immutability.
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338):
|
||||
//! empty_owned_tensor_validation_preserves_cursor_bounds_and_size_checks,
|
||||
//! owned_tensor_bounds_are_checked_before_any_callback_and_stream_can_recover,
|
||||
//! pathname_replacement_keeps_original_verified_file_and_index,
|
||||
//! opened_file_size_changes_are_refused_and_same_size_mutation_is_not_immutability.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): original_first_source_fence_retains_opened_fd_cursor_and_refuses_length_changes.
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338):
|
||||
//! original_first_source_fence_retains_opened_fd_cursor_and_refuses_length_changes.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -152,7 +152,8 @@ impl VerifiedGgufFile {
|
||||
#[allow(unsafe_code)]
|
||||
fn map_view(&self, map_offset: u64, map_len: usize) -> LoadResult<*mut std::ffi::c_void> {
|
||||
use std::os::windows::io::AsRawHandle;
|
||||
// SAFETY: a fresh read-only view of the retained verified handle at a granularity-aligned offset inside the indexed file.
|
||||
// SAFETY: a fresh read-only view of the retained verified handle at a granularity-aligned offset inside the
|
||||
// indexed file.
|
||||
let view =
|
||||
unsafe { leleka_libc_shim::map_file_readonly(self.file.as_raw_handle().cast(), map_offset, map_len) };
|
||||
if view.is_null() {
|
||||
@@ -183,7 +184,8 @@ impl VerifiedGgufFile {
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
/// The indexed tensor of `resident` holds exactly its bytes, and `length` bytes at `offset` lie inside it and the file.
|
||||
/// The indexed tensor of `resident` holds exactly its bytes, and `length` bytes at `offset` lie inside it and the
|
||||
/// file.
|
||||
fn check_resident_span(&self, resident: &ResidentTensor, offset: u64, length: u64) -> Result<()> {
|
||||
let tensor = self.index.tensors.get(resident.tensor_number).ok_or("GGUF tensor index is out of bounds")?;
|
||||
if tensor.bytes == 0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl VerifiedGgufFile, impl VerifiedGgufFile, impl ResidentTensor, impl VerifiedGgufFile.
|
||||
//! Moved out of the parent module by STRA-338: impl VerifiedGgufFile, impl VerifiedGgufFile, impl ResidentTensor, impl
|
||||
//! VerifiedGgufFile.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn next_source_id, impl ResidentTensor, impl ResidentStorage, impl std_ops_Deref, impl FileSpan, impl Drop_for_FileSpan.
|
||||
//! Moved out of the parent module by STRA-338: fn next_source_id, impl ResidentTensor, impl ResidentStorage, impl
|
||||
//! std_ops_Deref, impl FileSpan, impl Drop_for_FileSpan.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -12,10 +12,12 @@
|
||||
//! lets the fault compact) and `MADV_POPULATE_WRITE` to fault the whole range in before the file is read into it.
|
||||
//!
|
||||
//! [`settle`] (called by the stack after the bank load and the shard page-cache drop, before the banks are page-locked)
|
||||
//! reports the coverage from `/proc/self/smaps` and, when some 2 MiB ranges fell back to 4 KiB pages, asks the kernel to
|
||||
//! reports the coverage from `/proc/self/smaps` and, when some 2 MiB ranges fell back to 4 KiB pages, asks the kernel
|
||||
//! to
|
||||
//! collapse them synchronously (`MADV_COLLAPSE`, Linux 6.1+, independent of the THP sysfs knobs; best effort).
|
||||
//!
|
||||
//! `LELEKA_HUGEPAGES=thp` skips the hugetlbfs attempt. `LELEKA_BANK_THP=on` (the older claude/decode-parity knob, which only
|
||||
//! `LELEKA_HUGEPAGES=thp` skips the hugetlbfs attempt. `LELEKA_BANK_THP=on` (the older claude/decode-parity knob, which
|
||||
//! only
|
||||
//! advised the unaligned heap `Vec`) now selects `thp` too. Off by default. The bytes are the file's either way: this
|
||||
//! changes where the banks live, never what they hold. No system setting is read-write here.
|
||||
#![allow(unsafe_code)]
|
||||
@@ -31,7 +33,8 @@ pub enum Mode {
|
||||
Thp,
|
||||
}
|
||||
|
||||
/// The mode of this process (`LELEKA_HUGEPAGES` = `on` | `thp` | `off`; unset = `off`, or `thp` with `LELEKA_BANK_THP=on`).
|
||||
/// The mode of this process (`LELEKA_HUGEPAGES` = `on` | `thp` | `off`; unset = `off`, or `thp` with
|
||||
/// `LELEKA_BANK_THP=on`).
|
||||
pub fn mode() -> Mode {
|
||||
static MODE: std::sync::OnceLock<Mode> = std::sync::OnceLock::new();
|
||||
*MODE.get_or_init(|| {
|
||||
@@ -189,7 +192,8 @@ mod linux {
|
||||
|
||||
fn advise_and_populate(&self) -> std::io::Result<()> {
|
||||
let (base, map_len) = (self.base, self.map_len);
|
||||
// SAFETY: advice over our own live mapping; MADV_HUGEPAGE changes no contents (EINVAL without THP support: ignored).
|
||||
// SAFETY: advice over our own live mapping; MADV_HUGEPAGE changes no contents (EINVAL without THP support:
|
||||
// ignored).
|
||||
unsafe {
|
||||
libc::madvise(base as *mut libc::c_void, map_len, libc::MADV_HUGEPAGE);
|
||||
}
|
||||
@@ -217,7 +221,8 @@ mod linux {
|
||||
if self.hugetlb { self.map_len } else { self.len }
|
||||
}
|
||||
pub(crate) fn as_slice(&self) -> &[u8] {
|
||||
// SAFETY: `base..base + map_len` is our live mapping and `len <= map_len`; anonymous memory is initialised (zero or written).
|
||||
// SAFETY: `base..base + map_len` is our live mapping and `len <= map_len`; anonymous memory is initialised
|
||||
// (zero or written).
|
||||
unsafe { std::slice::from_raw_parts(self.base as *const u8, self.len) }
|
||||
}
|
||||
pub(crate) fn as_mut_slice(&mut self) -> &mut [u8] {
|
||||
@@ -295,7 +300,11 @@ mod linux {
|
||||
fn line(label: &str, c: &Coverage) -> String {
|
||||
let huge = c.thp_bytes + c.hugetlb_bytes;
|
||||
format!(
|
||||
"leleka-hugepages: {label}: {} bank buffers {:.2} GiB, huge {:.2} GiB ({:.1} %; THP {:.2}, hugetlbfs {:.2})",
|
||||
concat!(
|
||||
"leleka-hugepages: {}: {} bank buffers {:.2} GiB, huge {:.2} GiB ",
|
||||
"({:.1} %; THP {:.2}, hugetlbfs {:.2})"
|
||||
),
|
||||
label,
|
||||
c.buffers,
|
||||
gib(c.mapped_bytes),
|
||||
gib(huge),
|
||||
@@ -305,8 +314,10 @@ mod linux {
|
||||
)
|
||||
}
|
||||
|
||||
/// Report the coverage and collapse the 2 MiB ranges that fell back to 4 KiB pages (`MADV_COLLAPSE`, synchronous, best
|
||||
/// effort). Call before the banks are page-locked (a pinned page cannot be collapsed). `None` when nothing is placed.
|
||||
/// Report the coverage and collapse the 2 MiB ranges that fell back to 4 KiB pages (`MADV_COLLAPSE`, synchronous,
|
||||
/// best
|
||||
/// effort). Call before the banks are page-locked (a pinned page cannot be collapsed). `None` when nothing is
|
||||
/// placed.
|
||||
pub fn settle() -> Option<String> {
|
||||
if mode() == Mode::Off {
|
||||
return None;
|
||||
@@ -335,13 +346,15 @@ mod linux {
|
||||
|
||||
/// Asks the kernel to collapse each range into huge pages; returns (ranges that failed, last errno).
|
||||
fn collapse(ranges: &[(usize, usize)]) -> (usize, i32) {
|
||||
// linux/mman-common.h MADV_COLLAPSE = 25 (6.1+). Spelled out because libc 0.2.190 does not define it for the musl targets
|
||||
// linux/mman-common.h MADV_COLLAPSE = 25 (6.1+). Spelled out because libc 0.2.190 does not define it for the
|
||||
// musl targets
|
||||
// (the static CLI build failed to compile); glibc's libc::MADV_COLLAPSE has the same value.
|
||||
const MADV_COLLAPSE: libc::c_int = 25;
|
||||
let mut failed = 0usize;
|
||||
let mut last_error = 0i32;
|
||||
for &(base, len) in ranges.iter().filter(|r| r.1 > 0) {
|
||||
// SAFETY: advice over a live mapping of ours; MADV_COLLAPSE copies pages into a huge page without changing contents.
|
||||
// SAFETY: advice over a live mapping of ours; MADV_COLLAPSE copies pages into a huge page without changing
|
||||
// contents.
|
||||
if unsafe { libc::madvise(base as *mut libc::c_void, len, MADV_COLLAPSE) } != 0 {
|
||||
failed += 1;
|
||||
last_error = std::io::Error::last_os_error().raw_os_error().unwrap_or(0);
|
||||
|
||||
@@ -158,11 +158,13 @@ struct VerifiedPart {
|
||||
pub enum KarTrust {
|
||||
/// The whole archive was read once and matched its pinned SHA-256 and every section CRC-32.
|
||||
FullPass,
|
||||
/// A verification stamp for exactly this file in exactly this state (device, inode, size, mtime, ctime) stood in for the pass.
|
||||
/// A verification stamp for exactly this file in exactly this state (device, inode, size, mtime, ctime) stood in
|
||||
/// for the pass.
|
||||
Stamp,
|
||||
/// The parent process copied this unlinked memfd from a stamped file and said so (`--kar-attested-by-stamp`).
|
||||
AttestedMemfd,
|
||||
/// A sparse memfd (`verify_sparse`): the bytes of its extents matched the pinned digest of the extents; the rest is a hole.
|
||||
/// A sparse memfd (`verify_sparse`): the bytes of its extents matched the pinned digest of the extents; the rest is
|
||||
/// a hole.
|
||||
SparseExtents,
|
||||
}
|
||||
|
||||
@@ -174,7 +176,8 @@ pub struct KarStartupRead {
|
||||
pub metadata_bytes: u64,
|
||||
/// The partition books (8 bytes each).
|
||||
pub book_bytes: u64,
|
||||
/// Bytes hashed by the verification: the whole archive for `FullPass`, the extents for `SparseExtents`, otherwise 0.
|
||||
/// Bytes hashed by the verification: the whole archive for `FullPass`, the extents for `SparseExtents`, otherwise
|
||||
/// 0.
|
||||
pub hashed_bytes: u64,
|
||||
}
|
||||
|
||||
@@ -190,12 +193,16 @@ pub struct VerifiedKarPleArtifact {
|
||||
/// Verified against a pinned digest of `serve_extents` instead of the whole archive (a sparse memfd).
|
||||
sparse: bool,
|
||||
startup: KarStartupRead,
|
||||
/// The state of an ordinary archive file when it was verified (`None` for a sealed memfd, which cannot change, and where the
|
||||
/// platform has no such fields). Every row read compares the open file with it: a write, `touch`, `chmod` or rename of the
|
||||
/// file after verification refuses the read instead of serving bytes nobody checked. See `identity_recheck_enabled`.
|
||||
/// The state of an ordinary archive file when it was verified (`None` for a sealed memfd, which cannot change, and
|
||||
/// where the
|
||||
/// platform has no such fields). Every row read compares the open file with it: a write, `touch`, `chmod` or rename
|
||||
/// of the
|
||||
/// file after verification refuses the read instead of serving bytes nobody checked. See
|
||||
/// `identity_recheck_enabled`.
|
||||
identity: Option<crate::verify_stamp::FileIdentity>,
|
||||
}
|
||||
/// Handles a row read spreads its threads over. On Windows each has a file object of its own (a synchronous handle serializes the
|
||||
/// Handles a row read spreads its threads over. On Windows each has a file object of its own (a synchronous handle
|
||||
/// serializes the
|
||||
/// requests made through it, whatever the number of threads: 100,000 random reads of a cold chunk took 10 s that way).
|
||||
const ROW_HANDLES: usize = 16;
|
||||
/// Rows of the PLE table read through an owned handle of the archive (`VerifiedKarPleArtifact::row_reader`): the same
|
||||
@@ -206,10 +213,13 @@ pub struct KarPleRowReader {
|
||||
archive_bytes: u64,
|
||||
identity: Option<crate::verify_stamp::FileIdentity>,
|
||||
}
|
||||
/// A row read (three positional reads) that a warm file serves in this many nanoseconds or less takes the single-thread path.
|
||||
/// Memory-served reads of 10-20 bytes take about 1 us each; a read that waits for a device takes tens of microseconds or more.
|
||||
/// A row read (three positional reads) that a warm file serves in this many nanoseconds or less takes the single-thread
|
||||
/// path.
|
||||
/// Memory-served reads of 10-20 bytes take about 1 us each; a read that waits for a device takes tens of microseconds
|
||||
/// or more.
|
||||
const WARM_ROW_NS: u128 = 20_000;
|
||||
/// After a cold verdict the next calls read in parallel without probing (a cold file would pay the probe's latency each time).
|
||||
/// After a cold verdict the next calls read in parallel without probing (a cold file would pay the probe's latency each
|
||||
/// time).
|
||||
const COLD_SKIP_CALLS: u32 = 256;
|
||||
static COLD_SKIP: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
|
||||
|
||||
@@ -293,7 +303,8 @@ mod row_read_tests {
|
||||
// the reference: one thread, no probe
|
||||
let mut reference = vec![KarPleRowPacket { payload: [0; 50], partition: 0 }; 16];
|
||||
read_rows_chunk(&file, &parts, &rows, &mut reference).unwrap();
|
||||
// the file is in the page cache: the probe takes the single-thread path (or, on a loaded machine, falls back to threads;
|
||||
// the file is in the page cache: the probe takes the single-thread path (or, on a loaded machine, falls
|
||||
// back to threads;
|
||||
// the packets are the same either way)
|
||||
COLD_SKIP.store(0, Ordering::Relaxed);
|
||||
let probed = read_rows_parallel(&files, &parts, total, None, &rows, 8, 2, true).unwrap();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl KarPleProfile, impl KarPleRowPacket, fn is_unlinked, fn is_unlinked, impl KarTrust, impl KarStartupRead.
|
||||
//! Moved out of the parent module by STRA-338: impl KarPleProfile, impl KarPleRowPacket, fn is_unlinked, fn
|
||||
//! is_unlinked, impl KarTrust, impl KarStartupRead.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl std_fmt_Display, impl std_error_Error, fn typed, impl KarTensorSource, impl KarInspection.
|
||||
//! Moved out of the parent module by STRA-338: impl std_fmt_Display, impl std_error_Error, fn typed, impl
|
||||
//! KarTensorSource, impl KarInspection.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -10,7 +10,8 @@ impl VerifiedKarPleArtifact {
|
||||
pub fn verify(source: KarImmutableSource, profile: KarPleProfile) -> Result<Self, KarError> {
|
||||
Self::verify_with(source, profile, None)
|
||||
}
|
||||
/// `verify` for a sealed memfd that holds only the bytes the serve path reads (holes elsewhere, same file offsets and
|
||||
/// `verify` for a sealed memfd that holds only the bytes the serve path reads (holes elsewhere, same file offsets
|
||||
/// and
|
||||
/// length): the full-archive SHA-256 and the payload CRCs cannot be computed, so the pinned `extents_sha256`
|
||||
/// ([`digest_extents_with`] over `serve_extents`, measured once from the archive that matched its full pin) stands
|
||||
/// in for them, and the directory digest in the header (checked by `inspect`, inside the extents) covers the rest.
|
||||
@@ -80,9 +81,12 @@ impl VerifiedKarPleArtifact {
|
||||
if rows.iter().any(|r| *r >= PLE_ROWS) {
|
||||
return Err(KarError::Range("KAR PLE row outside table"));
|
||||
}
|
||||
// 16 rows are 48 random reads of a cold file: eight threads on handles of their own, two rows each. A file the page cache
|
||||
// holds answers each read in about a microsecond, and eight thread starts and joins then cost more than the reads
|
||||
// (about 0.1 ms per token of a decode window); `warm_probe` reads the first row on this thread, times it, and reads the
|
||||
// 16 rows are 48 random reads of a cold file: eight threads on handles of their own, two rows each. A file the
|
||||
// page cache
|
||||
// holds answers each read in about a microsecond, and eight thread starts and joins then cost more than the
|
||||
// reads
|
||||
// (about 0.1 ms per token of a decode window); `warm_probe` reads the first row on this thread, times it, and
|
||||
// reads the
|
||||
// other fifteen here too when it was served from memory.
|
||||
let packets = read_rows_parallel(
|
||||
self.row_handles(),
|
||||
|
||||
@@ -34,7 +34,10 @@ impl Admission {
|
||||
let stamps = crate::verify_stamp::global();
|
||||
// An unlinked sealed memfd: only if the parent attested the copy (see `set_attested_archive`).
|
||||
let attested_memfd = identity.is_none() && crate::verify_stamp::attested_archive() && is_unlinked(&reader.file);
|
||||
let stamped = matches!((stamps, identity.as_ref()), (Some(s), Some(id)) if s.trusts("kar", &profile.spec.archive_sha256, id));
|
||||
let stamped = match (stamps, identity.as_ref()) {
|
||||
(Some(s), Some(id)) => s.trusts("kar", &profile.spec.archive_sha256, id),
|
||||
_ => false,
|
||||
};
|
||||
Self { identity, stamps, attested_memfd, stamped }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn independent_handles, fn reopen_independent, fn reopen_independent, impl KarPleRowReader, fn read_rows_parallel, fn check_archive_state ....
|
||||
//! Moved out of the parent module by STRA-338: fn independent_handles, fn reopen_independent, fn reopen_independent,
|
||||
//! impl KarPleRowReader, fn read_rows_parallel, fn check_archive_state ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
@@ -125,8 +126,10 @@ fn read_fanned_out(
|
||||
});
|
||||
results.into_iter().collect()
|
||||
}
|
||||
/// The per-read guard of the archive: the pinned length, and for an ordinary file the state it had when it was verified. One `fstat` (the
|
||||
/// length check always did one); a different size, modification time or change time (any write, `touch`, `chmod`, rename or hard link made
|
||||
/// The per-read guard of the archive: the pinned length, and for an ordinary file the state it had when it was
|
||||
/// verified. One `fstat` (the
|
||||
/// length check always did one); a different size, modification time or change time (any write, `touch`, `chmod`,
|
||||
/// rename or hard link made
|
||||
/// after verification) is refused rather than served.
|
||||
pub(super) fn check_archive_state(
|
||||
file: &File,
|
||||
@@ -145,7 +148,8 @@ pub(super) fn check_archive_state(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `LELEKA_KAR_IDENTITY_RECHECK=off` (or `0`) turns the per-read comparison with the verified file state off (a file system that does not
|
||||
/// `LELEKA_KAR_IDENTITY_RECHECK=off` (or `0`) turns the per-read comparison with the verified file state off (a file
|
||||
/// system that does not
|
||||
/// keep `ctime` stable, for example). Read once; the default is on.
|
||||
pub(super) fn identity_recheck_enabled() -> bool {
|
||||
static ENABLED: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn read_region, fn u16_at, fn u32_at, fn u64_at, fn crc32, fn crc32_step ....
|
||||
//! Moved out of the parent module by STRA-338: fn read_region, fn u16_at, fn u32_at, fn u64_at, fn crc32, fn crc32_step
|
||||
//! ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -33,10 +33,13 @@ pub const PLE_ROW_PLANE_BYTES: u64 = 20;
|
||||
/// Planes the serve path reads (level 2).
|
||||
pub const PLE_PLANES: u64 = 2;
|
||||
|
||||
/// SHA-256 of the extents of the pinned archive (see [`digest_extents_with`]): 2 extents, 16,000,348,672 bytes, measured on the
|
||||
/// real archive file on the 5090 server (2026-11-02, `kar_census ARCHIVE --hash-extents`, 161.9 s at <= 300 MiB/s) -- the file
|
||||
/// SHA-256 of the extents of the pinned archive (see [`digest_extents_with`]): 2 extents, 16,000,348,672 bytes,
|
||||
/// measured on the
|
||||
/// real archive file on the 5090 server (2026-11-02, `kar_census ARCHIVE --hash-extents`, 161.9 s at <= 300 MiB/s) --
|
||||
/// the file
|
||||
/// that every holder job copies and whose full SHA-256 the engine checks on each of those copies. Hex:
|
||||
/// 7568b1211419a7c10a9b39a86230f75b7fa9c02839e36c9b5f2494ec7af72143. While it is all zero a sparse copy is refused unless the
|
||||
/// 7568b1211419a7c10a9b39a86230f75b7fa9c02839e36c9b5f2494ec7af72143. While it is all zero a sparse copy is refused
|
||||
/// unless the
|
||||
/// operator supplies the digest explicitly.
|
||||
pub const PLE_EXTENTS_SHA256: [u8; 32] = [
|
||||
117, 104, 177, 33, 20, 25, 167, 193, 10, 155, 57, 168, 98, 48, 247, 91, 127, 169, 192, 40, 57, 227, 108, 155, 95,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Extent, fn extents_bytes, fn normalize_extents, fn extents_cover, fn extents_overlap, fn digest_extents_with ....
|
||||
//! Moved out of the parent module by STRA-338: impl Extent, fn extents_bytes, fn normalize_extents, fn extents_cover,
|
||||
//! fn extents_overlap, fn digest_extents_with ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn decode_params_valid, fn decode_grid, fn kernel_decode, fn kernel_multiply, fn kernel_swiglu, fn stage_packet.
|
||||
//! Moved out of the parent module by STRA-338: fn decode_params_valid, fn decode_grid, fn kernel_decode, fn
|
||||
//! kernel_multiply, fn kernel_swiglu, fn stage_packet.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl std_error_Error, fn reject, fn round_up, impl WindowPlan, fn plan_window ....
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl std_error_Error, fn reject, fn round_up, impl
|
||||
//! WindowPlan, fn plan_window ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl std_error_Error, impl TensorClass, impl ClassLevels, fn check_level, impl ArchiveView ....
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl std_error_Error, impl TensorClass, impl
|
||||
//! ClassLevels, fn check_level, impl ArchiveView ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Selection, fn align, impl GpuWindow, impl RowShape, impl GpuRows, impl ScratchBytes ....
|
||||
//! Moved out of the parent module by STRA-338: impl Selection, fn align, impl GpuWindow, impl RowShape, impl GpuRows,
|
||||
//! impl ScratchBytes ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! Literal host port of the Original `src/core/native_dense.cpp` (`NativeDense::served_names`,
|
||||
//! `keep_unquantized_ple_key`, and the whole planning/validation half of `NativeDense::load`): which GGUF tensors are
|
||||
//! served natively, split-shard consistency, payload span validation, bytes per matrix and the shared Q8_1 scratch size.
|
||||
//! served natively, split-shard consistency, payload span validation, bytes per matrix and the shared Q8_1 scratch
|
||||
//! size.
|
||||
//! The device upload (`cudaMalloc` + `cudaMemcpy` + attaching `native_data`/`native_type`/`native_q8_1`) is the
|
||||
//! runtime's; this module produces the exact list it must perform and refuses with the Original's messages.
|
||||
//!
|
||||
@@ -92,7 +93,8 @@ pub fn eligible(row: &TensorRow, include_ple_key: bool) -> bool {
|
||||
if !name.starts_with("blk.") {
|
||||
return false;
|
||||
}
|
||||
// Match the native PLE kernel: Q2_0, IQ3_XXS, IQ4_XS and Q8_0 (UD-Q4_K_XL). Other keys retain the packed BF16 fallback.
|
||||
// Match the native PLE kernel: Q2_0, IQ3_XXS, IQ4_XS and Q8_0 (UD-Q4_K_XL). Other keys retain the packed BF16
|
||||
// fallback.
|
||||
if name == "blk.1.ple_key.weight" {
|
||||
return include_ple_key && matches!(row.kind, 42 | 18 | 23 | 8);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn fnv1a64, impl SharedArenaHeader, fn plan_shared_file, fn shared_mapping_note, fn open_shared_arena_file, fn arena_pin_cap_gib ....
|
||||
//! Moved out of the parent module by STRA-338: fn fnv1a64, impl SharedArenaHeader, fn plan_shared_file, fn
|
||||
//! shared_mapping_note, fn open_shared_arena_file, fn arena_pin_cap_gib ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -18,7 +18,8 @@ pub fn load_experts(
|
||||
let off: Vec<u64> = (0..layers).map(|l| l * blobs_per_layer * blob_bytes).collect();
|
||||
load_experts_ranges(path, dst, &off, &vec![n; layers as usize], threads, chunk)
|
||||
}
|
||||
/// `load_experts_ranges`: reads layer `L` (`layer_bytes[L]` bytes at file offset `layer_off[L]`) into `dst[layer_off[L]..]`
|
||||
/// `load_experts_ranges`: reads layer `L` (`layer_bytes[L]` bytes at file offset `layer_off[L]`) into
|
||||
/// `dst[layer_off[L]..]`
|
||||
/// with `threads` workers, `chunk` bytes per read, and returns one FNV-1a per layer. A short read is an error, never a
|
||||
/// zero fill.
|
||||
#[cfg(unix)]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl PageSource_for_File, impl fmt_Display_for, impl std_error_Error, fn err, impl PleReaderConfig, impl ReaderStats ....
|
||||
//! Moved out of the parent module by STRA-338: impl PageSource_for_File, impl fmt_Display_for, impl std_error_Error, fn
|
||||
//! err, impl PleReaderConfig, impl ReaderStats ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -105,8 +105,10 @@ impl Shared {
|
||||
pub(super) fn run(&self, job: Job, issued: Instant, delay: Duration) {
|
||||
let mut buf = AlignedBuf::new(2 * PAGE);
|
||||
let length = job.read.length;
|
||||
// A source that panics is a failed read like any other: the worker survives, the reader fails and every ticket is released.
|
||||
// Unwinding past this point would end the worker with the job's ticket still pending, and its `collect` would wait for ever.
|
||||
// A source that panics is a failed read like any other: the worker survives, the reader fails and every ticket
|
||||
// is released.
|
||||
// Unwinding past this point would end the worker with the job's ticket still pending, and its `collect` would
|
||||
// wait for ever.
|
||||
let read = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
|
||||
read_full_at(self.source.as_ref(), buf.window(length), job.read.offset)
|
||||
}))
|
||||
|
||||
@@ -79,10 +79,12 @@ fn cfg(offset: u64, rows: u64) -> PleReaderConfig {
|
||||
PleReaderConfig::new(offset, rows)
|
||||
}
|
||||
|
||||
// ---- a failed read never leaves a later ticket waiting (upstream ebe3383a: after a failed read the worker parked, `issue` kept
|
||||
// ---- a failed read never leaves a later ticket waiting (upstream ebe3383a: after a failed read the worker parked,
|
||||
// `issue` kept
|
||||
// queueing and the next `collect` blocked for ever). Every blocking call below runs on its own thread with a deadline.
|
||||
|
||||
/// Run `f` on a thread and return its result, or panic when it does not finish in five seconds (the hang this guards against).
|
||||
/// Run `f` on a thread and return its result, or panic when it does not finish in five seconds (the hang this guards
|
||||
/// against).
|
||||
fn within<T: Send + 'static>(what: &str, f: impl FnOnce() -> T + Send + 'static) -> T {
|
||||
let (tx, rx) = std::sync::mpsc::channel();
|
||||
thread::spawn(move || {
|
||||
@@ -115,7 +117,8 @@ impl PageSource for Flaky {
|
||||
}
|
||||
}
|
||||
|
||||
/// Rows whose first page is page `page` of a table at offset 0 with 90-byte rows (row 45 = byte 4050 straddles pages 0 and 1).
|
||||
/// Rows whose first page is page `page` of a table at offset 0 with 90-byte rows (row 45 = byte 4050 straddles pages 0
|
||||
/// and 1).
|
||||
fn row_on_page(page: u64) -> u32 {
|
||||
(page * PAGE as u64 / 90 + 1) as u32
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): max_inflight_bounds_concurrent_reads, keepalive_reads_a_table_page_when_idle_and_stops_after_the_window, a_failing_keepalive_turns_itself_off_not_the_reader, latency_ring_is_bounded ....
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): max_inflight_bounds_concurrent_reads,
|
||||
//! keepalive_reads_a_table_page_when_idle_and_stops_after_the_window,
|
||||
//! a_failing_keepalive_turns_itself_off_not_the_reader, latency_ring_is_bounded ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): prefetched_keys_are_matched_by_row_never_by_position, after_a_failed_read_every_ticket_and_every_later_issue_returns_the_error_and_never_blocks, a_dropped_ticket_and_a_failed_read_together_do_not_wedge_the_reader, a_source_that_panics_is_a_failed_read_not_a_hang.
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338):
|
||||
//! prefetched_keys_are_matched_by_row_never_by_position,
|
||||
//! after_a_failed_read_every_ticket_and_every_later_issue_returns_the_error_and_never_blocks,
|
||||
//! a_dropped_ticket_and_a_failed_read_together_do_not_wedge_the_reader,
|
||||
//! a_source_that_panics_is_a_failed_read_not_a_hang.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
/// Upstream 41cf05a0 `36381540` (`ngram/ple_reader_test.cpp` `prefetched_keys_are_reused`, issue #2622): `gather_batch` matched
|
||||
/// the prefetched tokens by position, so a prefetch of A..F gathered as D,E,F,A,B,C (or A gathered as A,A,A) read rows that were
|
||||
/// already in flight a second time. Here a ticket owns its rows and the row cache is keyed by row, so there is no position to
|
||||
/// match; this pins that: every output slot holds the bytes of ITS row whatever the order, duplication or overlap of the tickets
|
||||
/// Upstream 41cf05a0 `36381540` (`ngram/ple_reader_test.cpp` `prefetched_keys_are_reused`, issue #2622): `gather_batch`
|
||||
/// matched
|
||||
/// the prefetched tokens by position, so a prefetch of A..F gathered as D,E,F,A,B,C (or A gathered as A,A,A) read rows
|
||||
/// that were
|
||||
/// already in flight a second time. Here a ticket owns its rows and the row cache is keyed by row, so there is no
|
||||
/// position to
|
||||
/// match; this pins that: every output slot holds the bytes of ITS row whatever the order, duplication or overlap of
|
||||
/// the tickets
|
||||
/// in flight, and a row already fetched is not read again.
|
||||
#[test]
|
||||
fn prefetched_keys_are_matched_by_row_never_by_position() {
|
||||
@@ -60,7 +68,8 @@ fn prefetched_keys_are_matched_by_row_never_by_position() {
|
||||
let tag = format!("{} (cache {cache_rows}, io {io_threads:?})", case.name);
|
||||
let src = Mem::new(table(100, 2000 * 90, 90));
|
||||
let reader = PleReader::open(src.clone(), c.clone()).unwrap();
|
||||
// everything below is in flight at once; the wanted ticket is issued last, collected first, the others in
|
||||
// everything below is in flight at once; the wanted ticket is issued last, collected first, the others
|
||||
// in
|
||||
// reverse order of issue
|
||||
let tickets: Vec<_> = case.pre.iter().map(|&r| reader.issue(&[r])).collect();
|
||||
let wanted = reader.issue(&case.want);
|
||||
@@ -158,7 +167,8 @@ fn a_source_that_panics_is_a_failed_read_not_a_hang() {
|
||||
let r = Arc::clone(&reader);
|
||||
let first = within("collect after a panicking read", move || r.read_rows(&[row_on_page(10)]));
|
||||
assert!(first.is_err(), "{threads:?}");
|
||||
// the worker that met the panic is still there (or the reads run inline): later tickets fail promptly, they do not wait
|
||||
// the worker that met the panic is still there (or the reads run inline): later tickets fail promptly, they do
|
||||
// not wait
|
||||
let r = Arc::clone(&reader);
|
||||
assert!(within("later ticket", move || r.read_rows(&[row_on_page(2)])).is_err(), "{threads:?}");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): rows_match_the_oracle_including_out_of_range, rows_on_one_page_share_one_read_and_straddlers_read_two_pages, a_later_straddler_widens_the_read_of_its_first_page, plan_is_sorted_by_offset_and_covers_every_missing_row_once ....
|
||||
//! Tests of tests by topic (moved out of the test file by STRA-338): rows_match_the_oracle_including_out_of_range,
|
||||
//! rows_on_one_page_share_one_read_and_straddlers_read_two_pages, a_later_straddler_widens_the_read_of_its_first_page,
|
||||
//! plan_is_sorted_by_offset_and_covers_every_missing_row_once ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
/// (role, name suffix, dimensions, GGUF kind pinned for it if any) of a tensor of every layer or of one family of layers.
|
||||
/// (role, name suffix, dimensions, GGUF kind pinned for it if any) of a tensor of every layer or of one family of
|
||||
/// layers.
|
||||
type LayerEntry = (LayerRole, &'static str, &'static [u64], Option<u32>);
|
||||
|
||||
const GLOBAL_TENSORS: [(GlobalRole, &str, &[u64], Option<u32>); 5] = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl Error_for_BindingError, impl Qwen4ExpTopology, impl ResolvedTensor.
|
||||
//! Moved out of the parent module by STRA-338: impl fmt_Display_for, impl Error_for_BindingError, impl
|
||||
//! Qwen4ExpTopology, impl ResolvedTensor.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn validate_owner_index_split, fn validate_owner_metadata_split, fn required_uint, fn required_u32, fn required_float, fn required_array ....
|
||||
//! Moved out of the parent module by STRA-338: fn validate_owner_index_split, fn validate_owner_metadata_split, fn
|
||||
//! required_uint, fn required_u32, fn required_float, fn required_array ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ProvisionalExpertSource, impl IncrementalCapture.
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ProvisionalExpertSource, impl
|
||||
//! IncrementalCapture.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
@@ -204,7 +205,8 @@ impl IncrementalCapture {
|
||||
}
|
||||
}
|
||||
|
||||
/// The part of a chunk that falls inside one cell: where it goes in the cell, how long it is, where it starts in the chunk.
|
||||
/// The part of a chunk that falls inside one cell: where it goes in the cell, how long it is, where it starts in the
|
||||
/// chunk.
|
||||
struct ChunkSpan {
|
||||
offset: usize,
|
||||
count: usize,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ResidentExpertBankLease, impl ResidentExpertBankMember.
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ResidentExpertBankLease, impl
|
||||
//! ResidentExpertBankMember.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ResidentExpertBankSpan, impl ResidentExpertBank.
|
||||
//! Moved out of the parent module by STRA-338: impl Qwen4ExpArtifact, impl ResidentExpertBankSpan, impl
|
||||
//! ResidentExpertBank.
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//! Moved out of the parent module by STRA-338: fn retention_metadata_bytes, impl fmt_Display_for, impl Error_for_ResidentExpertSourceError, fn checked_descriptor, fn slot, fn memory_available ....
|
||||
//! Moved out of the parent module by STRA-338: fn retention_metadata_bytes, impl fmt_Display_for, impl
|
||||
//! Error_for_ResidentExpertSourceError, fn checked_descriptor, fn slot, fn memory_available ....
|
||||
|
||||
#[allow(unused_imports)]
|
||||
use super::*;
|
||||
|
||||
@@ -87,7 +87,8 @@ fn advise_sequential(file: &File) {
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn advise_sequential(_file: &File) {}
|
||||
|
||||
/// How far ahead of the reader the kernel is asked to fetch (`POSIX_FADV_WILLNEED`). A cold NVMe that serves one 128 KiB
|
||||
/// How far ahead of the reader the kernel is asked to fetch (`POSIX_FADV_WILLNEED`). A cold NVMe that serves one 128
|
||||
/// KiB
|
||||
/// window at a time reads at tens of MB/s; a few hundred MB of asynchronous readahead keeps its queue full while the
|
||||
/// hash runs.
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -103,9 +104,12 @@ fn advise_willneed(file: &File, offset: u64, len: u64) {
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
fn advise_willneed(_file: &File, _offset: u64, _len: u64) {}
|
||||
|
||||
/// Drop the clean page-cache pages of a span that has been read and handed on (`POSIX_FADV_DONTNEED`, never `drop_caches`;
|
||||
/// best effort, a no-op for a memfd). A hash pass reads each byte once: without this the 55 GB archive and the 84 GB of shards
|
||||
/// would sit in the page cache after the pass as a second copy of what the process keeps (or does not need) in its own memory.
|
||||
/// Drop the clean page-cache pages of a span that has been read and handed on (`POSIX_FADV_DONTNEED`, never
|
||||
/// `drop_caches`;
|
||||
/// best effort, a no-op for a memfd). A hash pass reads each byte once: without this the 55 GB archive and the 84 GB of
|
||||
/// shards
|
||||
/// would sit in the page cache after the pass as a second copy of what the process keeps (or does not need) in its own
|
||||
/// memory.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn evict_span(file: &File, offset: u64, len: u64) {
|
||||
if let Some(len) = std::num::NonZeroU64::new(len) {
|
||||
|
||||
Reference in New Issue
Block a user