Streaming: mapping calls ask only for what they need; the thread that loads runs ahead; a streaming log

All of the title's loading goes through one thread of its own, which maps
the pages of a batch and then submits it. Each page took up to four system
calls (unmap, split, map, commit), each waiting for the address-space lock:
200-400 us a page in the world. No split of a placeholder that is the
view's own, no commit of section pages that are committed
(VICTORY_MAP_LEAN=0: as before); the thread, below normal priority as the
title sets it, is lifted above it where it maps (VICTORY_STREAM_PRIORITY=0:
not). VICTORY_DSTORAGE_LOG=<file>: every request, status entry and the cost
of the mapping calls; VICTORY_STACKS names each thread's affinity.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 03:06:38 -06:00
1 parent 0abcb9fd89
commit 0c46a8cfe0
3 files changed
+345 -34

No files matched your search

+6 -6
View File
@@ -109,9 +109,9 @@ pub fn dump_stacks() {
if thread.is_null() {
continue;
}
let (frames, (priority, base)) = frames_of(thread);
let (frames, (priority, base, affinity)) = frames_of(thread);
eprintln!(
" thread {id} \"{}\" start {} priority {priority} (base {base})",
" thread {id} \"{}\" start {} priority {priority} (base {base}) affinity {affinity:#x}",
name_of(thread),
locate(start_of(thread))
);
@@ -124,7 +124,7 @@ pub fn dump_stacks() {
}
/// The thread's frames and its current and base scheduling priority (0-31).
fn frames_of(thread: HANDLE) -> (Vec<u64>, (i32, i32)) {
fn frames_of(thread: HANDLE) -> (Vec<u64>, (i32, i32, usize)) {
let mut frames = Vec::with_capacity(MAX_FRAMES);
let mut info: BasicInfo = BasicInfo {
exit_status: 0,
@@ -138,7 +138,7 @@ fn frames_of(thread: HANDLE) -> (Vec<u64>, (i32, i32)) {
// the query and the read below.
// SAFETY: a thread of this process that is not this one.
if unsafe { SuspendThread(thread) } == u32::MAX {
return (frames, (0, 0));
return (frames, (0, 0, 0));
}
// SAFETY: writes `info`, whose layout and size are the system's.
let status = unsafe {
@@ -153,7 +153,7 @@ fn frames_of(thread: HANDLE) -> (Vec<u64>, (i32, i32)) {
if status != 0 || info.teb.is_null() {
// SAFETY: suspended above.
unsafe { ResumeThread(thread) };
return (frames, (0, 0));
return (frames, (0, 0, 0));
}
// SAFETY: the TEB of a suspended thread of this process: its NT_TIB
// holds the stack base at +8 and the stack limit at +0x10.
@@ -170,7 +170,7 @@ fn frames_of(thread: HANDLE) -> (Vec<u64>, (i32, i32)) {
}
ResumeThread(thread);
}
(frames, (info.priority, info.base_priority))
(frames, (info.priority, info.base_priority, info.affinity))
}
fn start_of(thread: HANDLE) -> usize {