Skip to content

runsc: defer checkpoint binding for no-root sandbox prewarming - #16368

Open
jingyugao wants to merge 1 commit into
gvisor:masterfrom
jingyugao:feat/defer-checkpoint-upstream
Open

jingyugao wants to merge 1 commit into
gvisor:masterfrom
jingyugao:feat/defer-checkpoint-upstream

Conversation

@jingyugao

Copy link
Copy Markdown
Contributor

Allow a no-root sandbox to complete root preparation before workload assignment,
then bind checkpoint files through an explicit child restore.

When root start waits for a checkpoint, kubelet cannot advance past
RunPodSandbox to create and start application containers. This keeps child
CRI and OCI preparation on the restore request path.

With --defer-checkpoint, orchestration can prepare the root, precreate the
child and wait at child start. Once assigned, child restore supplies the
checkpoint and authorized mounts.

Root restore prepares networking and the main MemoryFile, pauses the loader
kernel and registers the root. The first explicit child restore initializes
checkpoint readers once, outside the loader mutex. The existing registration
barrier triggers shared kernel restore. Assigned mounts are refreshed before
Gofer creation.

This is opt-in for no-root sandboxes with a child. Existing loader states and
ordinary restore behavior are retained. Split filesystem restore is unsupported.

Validation

Validated in our self-hosted production Kubernetes cluster using dedicated
synthetic workloads. Both modes used the same runtime build, workload and
resource configuration, with no-root, systrap, background restore, uncompressed
checkpoints and warm local page cache. Ten restores per mode were run
sequentially.

       │ baseline.bench │            deferred.bench            │
       │     sec/op     │    sec/op     vs base                │
Resume     263.8m ± 27%   192.9m ± 10%  -26.89% (p=0.000 n=10)

Median resume latency decreased by 70.9 ms (26.9%). Baseline/deferred
standard deviations were 45.1/21.9 ms.

The metric covers the server-side resume operation through guest availability.
It measures this change together with orchestration precreating the child.
PID, process start, a 32 MiB memory checksum, persistent-file marker and counter
continuity were preserved. Results are specific to this deployment; the final
rebased revision has not been rebenchmarked.

Local source validation passed for the full //:release build, make lint, make lint-cc,
config_test, serialization_test, and boot_test with TestRun excluded.
TestRun fails with seccomp notification EBUSY on both this change and
unmodified upstream master.

Related to #15803.
Page-loading prioritization is separate work.

@milantracy milantracy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks!

can you

  • rebase
  • add tests that use a no-root sandbox, and restore with --defer-checkpoint

Comment thread runsc/boot/controller.go Resolved
Comment thread runsc/config/config.go Resolved
Comment thread runsc/boot/controller.go Resolved
@jingyugao
jingyugao force-pushed the feat/defer-checkpoint-upstream branch from 2bcf14e to b09ed75 Compare October 27, 2026 02:41
@jingyugao

Copy link
Copy Markdown
Contributor Author

thanks!

can you

  • rebase
  • add tests that use a no-root sandbox, and restore with --defer-checkpoint

Thanks! Rebased and addressed the comments, including no-root deferred restore tests. Local build, lint, and KVM tests pass. Please take another look.

@jingyugao
jingyugao force-pushed the feat/defer-checkpoint-upstream branch 2 times, most recently from 419a6d7 to 6c2ff21 Compare October 28, 2026 06:00
@ayushr2

ayushr2 commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

What is a "no-root sandbox". The "root" word is very overloaded. Are you talking about the root container (first/pause container). Or root UID?

@jingyugao

Copy link
Copy Markdown
Contributor Author

What is a "no-root sandbox". The "root" word is very overloaded. Are you talking about the root container (first/pause container). Or root UID?

"root" means the root (pause in k8s) container, not root UID. This is the existing --no-root-container mode, where the pause container has no process in the sandbox. The sandbox can therefore be prepared before the checkpoint is known, and the checkpoint is bound only when the child is restored. This takes pod setup off the resume path (20~50ms improvement).

@jingyugao
jingyugao requested a review from milantracy October 29, 2026 06:04
jingyugao added a commit to jingyugao/gvisor that referenced this pull request Oct 31, 2026
Prepare no-root sandboxes without opening checkpoint files. Bind the
checkpoint when the first explicit child restore supplies it, and
initialize the readers once outside the loader mutex. Verify that later
child restores resolve to the same open checkpoint directory. Refresh
deferred child mounts before gofer creation so orchestration can create
children before workload assignment.

Publish the first restore failure before releasing checkpoint resources,
and serialize it with the final child registration. Keep the session
available when a plain start arrives before checkpoint binding. Close
rejected child descriptors and clean up asynchronous loads and memory
files according to their ownership and the private loader kickoff state.

Cover deferred restore through the CLI and the container API, including
path aliases, CPU limits after a translated start, failure ordering, and
checkpoint resource cleanup.

Signed-off-by: gaojingyu <[email protected]>
@jingyugao
jingyugao force-pushed the feat/defer-checkpoint-upstream branch from 6c2ff21 to d4ffac0 Compare December 3, 2026 01:22
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.

3 participants