Skip to content

docs: the VMMs map the snapshot MAP_PRIVATE, not MAP_SHARED (#307) - #335

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/campaign-doc-map-private
Sep 24, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:fix/campaign-doc-map-private

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

One-paragraph correction to a merged note. Docs only.

docs/notes/2026-09-22-exec-throughput-campaign-results.md said guest memory is "a MAP_SHARED
mapping of one snapshot memory file which the worker pins once via PinMemoryFile". That collapses
two different mappings into one. pin_linux.go is explicit:

  • the worker maps the file MAP_SHARED and mlocks it, once;
  • each VMM maps that same file MAP_PRIVATE — and that copy-on-write relationship is the density
    mechanism, per the function's own doc comment ("THIS IS THE DENSITY MECHANISM").

#307's measurements confirm the private side directly: /proc/<pid>/maps reads
256MiB rw-p …/memfile, Rss is 31 MiB of the 256 MiB region with 5.7 MiB Private_Dirty, and THP
is madvise with AnonHugePages: 0, so 4 KiB PTEs.

Why it is worth a PR

The conclusion the paragraph exists to support is unaffected — 64 VMs still read one physical copy
and are still charged only for the pages they dirty, which is why residency measured ~0.9 MiB per VM
against a 288 MiB limit and why the tier uses 8.3 GiB of 754 GiB.

But the wrong mechanism invites wrong reasoning downstream, and did: it makes shared-mapping teardown
look like a plausible cause of Destroy's cost. #307 measured that and it is not — the reap floor is RCU
grace periods in kvm_vm_release (rcu_barrier 58%, __synchronize_srcu 28%), which is independent of
whether the mapping is shared or private. A reader starting from the old sentence would spend time on a
hypothesis the data has already closed.

Corrected inline with a dated note rather than silently edited, because the original claim was quoted
in issue threads and someone tracing it should find out what changed.

Testing

make fmt and make lint pass. No code changes.

…#307)

The campaign note described guest memory as "a MAP_SHARED mapping of one
snapshot memory file which the worker pins once via PinMemoryFile", which
collapses two different mappings into one. pin_linux.go is explicit: the WORKER
maps the file MAP_SHARED and mlocks it, and "each VMM maps the same file
MAP_PRIVATE" — that copy-on-write relationship is the density mechanism.

rossoctl#307's measurements confirm the private side directly: /proc/<pid>/maps reads
`256MiB rw-p .../memfile`, Rss is 31 MiB of the 256 MiB region with 5.7 MiB
Private_Dirty, and THP is madvise with AnonHugePages: 0, so 4 KiB PTEs.

The density conclusion the paragraph exists to support is unaffected — 64 VMs
still read one physical copy and are still charged only for pages they dirty,
which is why residency measured ~0.9 MiB per VM against a 288 MiB limit. Only
the mechanism was described wrongly, and the wrong description matters because
it invites reasoning about shared-mapping teardown costs that do not apply:
rossoctl#307 found the reap floor is RCU grace periods in kvm_vm_release, independent
of whether the mapping is shared or private.

Notes the correction inline rather than silently editing, since the original
claim was quoted in issue threads.

Refs rossoctl#307

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>

@rubambiza rubambiza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Accurate one-paragraph docs correction, verified against source. The note previously said guest memory is a MAP_SHARED mapping the worker pins, conflating two mappings; the corrected text matches remote-worker/internal/vmpool/pin_linux.go exactly — the worker maps the memfile MAP_SHARED + mlocks it once (lines 37/41), and each VMM maps the same file MAP_PRIVATE, which the function's own doc comment labels "THIS IS THE DENSITY MECHANISM" (line 14). Recording the correction inline with a dated note rather than silently editing is the right call given the original was quoted in issue threads. Net change is the single file (+8/-2), the base blob is current with main, and CI is green.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: Docs (Markdown), verified against pin_linux.go source
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, signed-off: yes; conventional docs: prefix: yes
CI status: passing (all 13 checks green)

@pdettori
pdettori merged commit 69f3d16 into rossoctl:main Sep 24, 2026
13 checks passed
@pdettori
pdettori deleted the fix/campaign-doc-map-private branch September 24, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants