Repository navigation
runsc: do not account memory of disk backed private MemoryFiles - #16619
Merged
copybara-service[bot] merged 1 commit intoOct 31, 2026
Merged
Conversation
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them.
joeyhe-mercor
approved these changes
Oct 28, 2026
nixprime
approved these changes
Oct 28, 2026
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them. FUTURE_COPYBARA_INTEGRATE_REVIEW=#16619 from ayushr2:private-mf-no-accounting 0af51ca PiperOrigin-RevId: 1009219970
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them. FUTURE_COPYBARA_INTEGRATE_REVIEW=#16619 from ayushr2:private-mf-no-accounting 0af51ca PiperOrigin-RevId: 1009219970
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them. FUTURE_COPYBARA_INTEGRATE_REVIEW=#16619 from ayushr2:private-mf-no-accounting 0af51ca PiperOrigin-RevId: 1009219970
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 30, 2026
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them. FUTURE_COPYBARA_INTEGRATE_REVIEW=#16619 from ayushr2:private-mf-no-accounting 0af51ca PiperOrigin-RevId: 1009219970
copybara-service Bot
pushed a commit
that referenced
this pull request
Oct 31, 2026
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host file. While the sandbox runs, pages written to it are never reported as memory usage: they are allocated without being marked committed, and only the main MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page with data as committed and LoadFrom accounts every restored page, though, so a checkpoint turns the whole file into Tmpfs usage for the running sandbox, and a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of database files into its rootfs overlay reported 18 GB of memory after restore while holding 3 GB. The pages of a disk backed file are host page cache for that file, which the host can drop at any time, so they are not memory held by the sandbox. Disable memory accounting for private MemoryFiles so that neither the running nor the restored sandbox reports them. Auto-fixed-by: [🤖] @EtiennePerot FUTURE_COPYBARA_INTEGRATE_REVIEW=#16619 from ayushr2:private-mf-no-accounting 0af51ca PiperOrigin-RevId: 1010803299
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A private MemoryFile backs a disk backed overlay or tmpfs mount with a host
file. While the sandbox runs, pages written to it are never reported as memory
usage: they are allocated without being marked committed, and only the main
MemoryFile is scanned for committed pages. MemoryFile.SaveTo marks every page
with data as committed and LoadFrom accounts every restored page, though, so a
checkpoint turns the whole file into Tmpfs usage for the running sandbox, and
a restored sandbox reports it for its lifetime. A sandbox that copied 15 GB of
database files into its rootfs overlay reported 18 GB of memory after restore
while holding 3 GB.
The pages of a disk backed file are host page cache for that file, which the
host can drop at any time, so they are not memory held by the sandbox.
Disable memory accounting for private MemoryFiles so that neither the running
nor the restored sandbox reports them.