Skip to content

runsc: do not account memory of disk backed private MemoryFiles - #16619

Merged
copybara-service[bot] merged 1 commit into
google:masterfrom
ayushr2:private-mf-no-accounting
Oct 31, 2026
Merged

copybara-service[bot] merged 1 commit into
google:masterfrom
ayushr2:private-mf-no-accounting

Conversation

@ayushr2

@ayushr2 ayushr2 commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

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.

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.
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
@copybara-service
copybara-service Bot merged commit aa767e4 into google:master Oct 31, 2026
15 of 16 checks passed
@ayushr2
ayushr2 deleted the private-mf-no-accounting branch November 12, 2026 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants