Skip to content

GC: Suspend Go GC during boot, checkpoint, and restore. - #16735

Open
parth-opensrc wants to merge 1 commit into
gvisor:masterfrom
parth-opensrc:pr-suspend-gc
Open

parth-opensrc wants to merge 1 commit into
gvisor:masterfrom
parth-opensrc:pr-suspend-gc

Conversation

@parth-opensrc

@parth-opensrc parth-opensrc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Fixes #16134.
Fixes #16152.

Sandbox boot, checkpoint save, and checkpoint restore allocate a rapidly growing
Go heap from a small initial GOGC target, triggering repeated GC cycles on the
critical path (especially under tight container CPU quotas).

This PR suspends periodic Go garbage collection across Sentry lifecycle phases:

  • Add pkg/garbage to temporarily disable periodic GC (SetGCPercent(-1))
    under a cgroup-aware soft memory limit (min(1 GiB, (totalMem - untrackedMem) / 2)),
    automatically resuming regular GC if a collection runs.
  • Suspend GC at the start of runsc boot until the sandbox is idle for 250 ms
    or at most 500 ms after container start, and coordinate idle heap scavenging
    via garbage.MaybeFreeOSMemory.
  • Suspend GC across checkpoint save (state.Save) and restore (Loader.Restore
    through async page loading completion).

Benchmarks

Benchmarks vs. origin/master

Ran on 12x GCE c4-standard-16 (cos-129-lts, cgroup2fs), ABBA-interleaved
on each VM (before: origin/master at 0bbcbf9de762, after: this PR).

1. Standalone runsc lifecycle, CFS CPU quota (state4k), and large heap (bigheap)

  • Idle busybox sandbox (RunscRun, RunscCheckpoint, RunscRestore), n=16.
  • state4k (4,000 tmpfs files) under cgroup v2 cpu.max (0.25, 1,
    unlimited) with --sandbox-creation-cpu-policy=1x and
    --sandbox-lifecycle-cpu-policy=1x, n=16.
  • bigheap (100,000 tmpfs files, ~320 MiB pre-save Sentry heap) at
    cpu=unlimited and cpu=0.25, n=8.
goos: linux
goarch: amd64
pkg: runsc-lifecycle
                                                     │    before    │                after                 │
                                                     │    sec/op    │    sec/op     vs base                │
RunscRun-16                                            19.10m ±  1%   18.01m ±  3%   -5.74% (p=0.000 n=16)
RunscCheckpoint/after=start-16                         12.94m ±  2%   12.21m ±  1%   -5.69% (p=0.000 n=16)
RunscRestore-16                                        25.13m ±  1%   23.79m ±  1%   -5.33% (p=0.000 n=16)
RunscCheckpoint/after=restore-16                       12.65m ±  2%   11.40m ±  2%   -9.86% (p=0.000 n=16)
RunscCheckpoint/vcpus=16/cpu=0.25-16                   352.7m ±  5%   199.4m ±  9%  -43.48% (p=0.000 n=16)
Suspend/vcpus=16/cpu=0.25-16                           368.3m ± 11%   268.7m ± 12%  -27.04% (p=0.000 n=16)
WarmRestore/vcpus=16/cpu=0.25-16                       268.9m ±  7%   181.5m ± 11%  -32.49% (p=0.000 n=16)
RunscCheckpoint/vcpus=16/cpu=1-16                      60.55m ±  3%   58.93m ±  1%   -2.68% (p=0.000 n=16)
Suspend/vcpus=16/cpu=1-16                              64.01m ± 14%   62.49m ±  1%   -2.38% (p=0.000 n=16)
WarmRestore/vcpus=16/cpu=1-16                          56.08m ±  1%   53.06m ±  1%   -5.39% (p=0.000 n=16)
RunscCheckpoint/vcpus=16/cpu=unlimited-16              72.08m ±  1%   70.67m ±  2%   -1.96% (p=0.001 n=16)
Suspend/vcpus=16/cpu=unlimited-16                      75.49m ±  2%   74.00m ±  2%   -1.97% (p=0.002 n=16)
WarmRestore/vcpus=16/cpu=unlimited-16                  67.71m ±  0%   64.99m ±  1%   -4.03% (p=0.000 n=16)
Checkpoint/vcpus=16/app=bigheap/cpu=unlimited-16        1.730 ±  4%    1.644 ±  5%   -4.96% (p=0.050 n=8)
CheckpointExit/vcpus=16/app=bigheap/cpu=unlimited-16    1.785 ±  4%    1.701 ±  5%   -4.69% (p=0.050 n=8)
Restore/vcpus=16/app=bigheap/cpu=unlimited-16          752.7m ±  2%   783.9m ±  2%   +4.15% (p=0.010 n=8)
Checkpoint/vcpus=16/app=bigheap/cpu=0.25-16            14.937 ±  8%    8.864 ±  5%  -40.65% (p=0.000 n=8)
CheckpointExit/vcpus=16/app=bigheap/cpu=0.25-16        15.186 ±  9%    9.158 ±  5%  -39.69% (p=0.000 n=8)
Restore/vcpus=16/app=bigheap/cpu=0.25-16                5.298 ±  5%    3.962 ±  1%  -25.23% (p=0.000 n=8)
geomean                                                227.7m         193.2m        -15.14%

2. Sentry memory (Pss_Anon, RssAnon, and checkpoint VmHWM)

                                                    │    before     │                after                 │
                                                    │       B       │      B        vs base                │
IdleSentryPssAnon/after=start/age=1s-16                5.545Mi ± 1%   5.295Mi ± 2%   -4.51% (p=0.000 n=16)
IdleSentryPssAnon/after=start/age=5s-16                5.545Mi ± 1%   5.295Mi ± 2%   -4.51% (p=0.000 n=16)
IdleSentryPssAnon/after=restore/age=1s-16              6.838Mi ± 1%   6.691Mi ± 2%   -2.14% (p=0.011 n=16)
IdleSentryPssAnon/after=restore/age=5s-16              6.838Mi ± 1%   6.691Mi ± 2%   -2.14% (p=0.011 n=16)
IdleSentryRssAnon/after=start/age=1s-16                5.559Mi ± 1%   5.309Mi ± 2%   -4.50% (p=0.000 n=16)
IdleSentryRssAnon/after=restore/age=1s-16              6.852Mi ± 1%   6.705Mi ± 2%   -2.14% (p=0.011 n=16)
SentryPeakRSS/vcpus=16/app=state4k/cpu=0.25-16         56.63Mi ± 0%   59.27Mi ± 0%   +4.65% (p=0.000 n=16)
RestoredSentryPssAnon/vcpus=16/cpu=0.25-16            10.029Mi ± 1%   9.770Mi ± 0%   -2.59% (p=0.000 n=16)
SentryPeakRSS/vcpus=16/app=state4k/cpu=1-16            56.29Mi ± 1%   59.03Mi ± 0%   +4.88% (p=0.000 n=16)
RestoredSentryPssAnon/vcpus=16/cpu=1-16               10.029Mi ± 1%   9.732Mi ± 0%   -2.96% (p=0.000 n=16)
SentryPeakRSS/vcpus=16/app=state4k/cpu=unlimited-16    56.68Mi ± 1%   59.13Mi ± 0%   +4.32% (p=0.000 n=16)
RestoredSentryPssAnon/vcpus=16/cpu=unlimited-16        11.14Mi ± 1%   10.93Mi ± 1%   -1.93% (p=0.000 n=16)
SentryPeakRSS/vcpus=16/app=bigheap/cpu=unlimited-16    643.6Mi ± 0%   716.8Mi ± 0%  +11.37% (p=0.000 n=8)
SentryPeakRSS/vcpus=16/app=bigheap/cpu=0.25-16         638.3Mi ± 2%   716.7Mi ± 0%  +12.30% (p=0.000 n=8)
geomean                                                21.51Mi        21.64Mi        +0.57%

Notes on memory metrics:

  • SentryPeakRSS (VmHWM during non-resuming runsc checkpoint): increases by
    ~2.6 MiB on state4k and ~75 MiB on bigheap because temporary
    serialization/compression buffers are not collected right before the Sentry
    exits. When a cgroup memory limit is set, gccontrol.Suspend caps Go's soft
    memory limit to half the remaining cgroup budget so GC resumes before OOM.

3. //test/benchmarks/base (n=16 via Docker)

goos: linux
goarch: amd64
pkg: gvisor.dev/gvisor/test/benchmarks/base
                                                │    before    │                after                │
                                                │    sec/op    │    sec/op     vs base               │
StartupEmpty-16                                   392.6m ± 38%   313.2m ± 26%       ~ (p=0.254 n=16)
StartupNginx-16                                   596.5m ±  2%   591.5m ±  3%       ~ (p=0.752 n=16)
StartupNode-16                                    946.5m ±  2%   938.9m ±  3%       ~ (p=0.110 n=16)
CheckpointEmpty-16                                73.90m ±  6%   72.32m ±  6%       ~ (p=0.539 n=16)
RestoreEmpty-16                                   180.0m ±  4%   176.6m ±  4%       ~ (p=0.210 n=16)
CheckpointNginx-16                                105.0m ±  1%   103.8m ±  2%       ~ (p=0.056 n=16)
RestoreNginx-16                                   243.8m ±  3%   237.1m ±  2%       ~ (p=0.110 n=16)
SizeNginx-16                                       1.355 ±  2%    1.357 ±  3%       ~ (p=0.642 n=16)
SizeNode-16                                        2.195 ±  2%    2.199 ±  2%       ~ (p=0.669 n=16)
SizeEmpty-16                                       1.294 ±  1%    1.299 ±  1%       ~ (p=0.515 n=16)
SizeEmpty/benchtime=10x-16                         2.113 ±  0%    2.108 ±  0%       ~ (p=0.341 n=16)
Syscallbench/benchtime.1x/syscall.getpid-16       12.47m ±  5%   12.09m ±  5%       ~ (p=0.254 n=16)
Syscallbench/benchtime.1x/syscall.getpidopt-16    12.23m ±  8%   11.66m ±  4%  -4.60% (p=0.008 n=16)
Syscallbench/syscall.getpid-16                    2.571µ ±  5%   2.531µ ±  3%       ~ (p=0.407 n=16)
Syscallbench/syscall.getpidopt-16                 1.181µ ± 15%   1.209µ ±  8%       ~ (p=0.985 n=16)
Hackbench/ipcMode.pipe/processMode.thread-16      171.0m ±  3%   168.8m ±  3%       ~ (p=0.305 n=16)
Hackbench/ipcMode.socket/processMode.process-16   650.2m ±  1%   646.6m ±  1%       ~ (p=0.184 n=16)
Sysbench/testname.CPU-16                          287.7m ±  4%   280.0m ±  2%       ~ (p=0.067 n=16)
Sysbench/testname.CPU/threads.16-16               281.6m ±  4%   280.1m ±  3%       ~ (p=0.926 n=16)
Sysbench/testname.Memory-16                        1.307 ±  1%    1.306 ±  1%       ~ (p=0.752 n=16)
Sysbench/testname.Memory/threads.16-16             1.268 ±  1%    1.274 ±  1%       ~ (p=0.254 n=16)
Sysbench/testname.Mutex-16                        288.0m ±  2%   284.8m ±  2%       ~ (p=0.642 n=16)
geomean                                           112.1m         109.8m        -2.01%

                           │                before                │                            after                            │
                           │ average_container_memory_usage.bytes │ average_container_memory_usage.bytes  vs base               │
SizeEmpty-16                                          13.50M ± 4%                            12.95M ± 2%  -4.11% (p=0.002 n=16)
SizeEmpty/benchtime=10x-16                            12.73M ± 1%                            12.49M ± 1%  -1.93% (p=0.000 n=16)
geomean                                               13.11M                                 12.72M       -3.03%

Benchmarks vs. Reference Patches (#16134 + #16152, n=32)

Ran on 12x GCE c4-standard-16 (cos-129-lts, cgroup2fs), ABBA-interleaved
on each VM (n=32 across all suites) on the same base commit (0bbcbf9de762):

  • before: @EtiennePerot's combined reference branches (autoresearch/defer-gc
    • autoresearch/gc-off-during-save) cherry-picked onto 0bbcbf9de762
  • after: this PR (5068ecb10)

1. Standalone runsc lifecycle, CFS CPU quota (state4k), and large heap (bigheap)

goos: linux
goarch: amd64
pkg: runsc-lifecycle
                                                     │    before    │                after                 │
                                                     │    sec/op    │    sec/op     vs base                │
RunscRun-16                                            17.82m ±  1%   18.05m ±  2%        ~ (p=0.174 n=32)
RunscCheckpoint/after=start-16                         12.05m ±  4%   12.06m ±  3%        ~ (p=0.626 n=32)
RunscRestore-16                                        23.60m ±  1%   23.85m ±  1%        ~ (p=0.319 n=32)
RunscCheckpoint/after=restore-16                       10.90m ±  3%   10.90m ±  1%        ~ (p=0.511 n=32)
RunscCheckpoint/vcpus=16/cpu=0.25-16                   189.3m ± 14%   192.9m ± 10%        ~ (p=0.805 n=32)
Suspend/vcpus=16/cpu=0.25-16                           255.4m ± 11%   255.6m ± 11%        ~ (p=0.562 n=32)
WarmRestore/vcpus=16/cpu=0.25-16                       181.9m ± 12%   185.5m ± 18%        ~ (p=0.942 n=32)
RunscCheckpoint/vcpus=16/cpu=1-16                      66.10m ±  0%   66.52m ±  1%        ~ (p=0.080 n=32)
Suspend/vcpus=16/cpu=1-16                              69.44m ±  1%   69.53m ±  0%        ~ (p=0.724 n=32)
WarmRestore/vcpus=16/cpu=1-16                          62.81m ±  0%   62.96m ±  1%        ~ (p=0.135 n=32)
RunscCheckpoint/vcpus=16/cpu=unlimited-16              65.20m ±  2%   66.11m ±  2%        ~ (p=0.270 n=32)
Suspend/vcpus=16/cpu=unlimited-16                      68.44m ±  2%   69.43m ±  1%        ~ (p=0.270 n=32)
WarmRestore/vcpus=16/cpu=unlimited-16                  61.11m ±  2%   60.94m ±  1%        ~ (p=0.878 n=32)
Checkpoint/vcpus=16/app=bigheap/cpu=unlimited-16        1.965 ±  7%    1.930 ±  9%   -1.82% (p=0.033 n=32)
CheckpointExit/vcpus=16/app=bigheap/cpu=unlimited-16    2.024 ±  7%    1.990 ±  9%   -1.69% (p=0.037 n=32)
Restore/vcpus=16/app=bigheap/cpu=unlimited-16          847.6m ± 11%   891.5m ± 12%   +5.18% (p=0.000 n=32)
Checkpoint/vcpus=16/app=bigheap/cpu=0.25-16            10.999 ± 14%    7.837 ± 12%  -28.75% (p=0.000 n=32)
CheckpointExit/vcpus=16/app=bigheap/cpu=0.25-16        11.211 ± 12%    8.129 ± 12%  -27.49% (p=0.000 n=32)
Restore/vcpus=16/app=bigheap/cpu=0.25-16                3.961 ± 12%    3.497 ± 13%  -11.72% (p=0.000 n=32)
geomean                                                201.9m         194.9m         -3.48%

2. Sentry memory (Pss_Anon, RssAnon, and checkpoint VmHWM)

                                                    │    before    │                after                 │
                                                    │      B       │      B        vs base                │
IdleSentryPssAnon/after=start/age=1s-16               5.350Mi ± 2%   5.023Mi ± 2%   -6.10% (p=0.000 n=32)
IdleSentryPssAnon/after=start/age=5s-16               5.350Mi ± 2%   5.023Mi ± 2%   -6.10% (p=0.000 n=32)
IdleSentryPssAnon/after=restore/age=1s-16             6.791Mi ± 1%   6.475Mi ± 2%   -4.66% (p=0.000 n=32)
IdleSentryPssAnon/after=restore/age=5s-16             6.791Mi ± 1%   6.475Mi ± 2%   -4.66% (p=0.000 n=32)
IdleSentryRssAnon/after=start/age=1s-16               5.363Mi ± 2%   5.037Mi ± 2%   -6.08% (p=0.000 n=32)
IdleSentryRssAnon/after=restore/age=1s-16             6.805Mi ± 1%   6.488Mi ± 2%   -4.65% (p=0.000 n=32)
SentryPeakRSS/vcpus=16/app=state4k/cpu=0.25-16        58.15Mi ± 0%   58.08Mi ± 0%        ~ (p=0.179 n=32)
RestoredSentryPssAnon/vcpus=16/cpu=0.25-16            9.814Mi ± 0%   9.424Mi ± 0%   -3.98% (p=0.000 n=32)
SentryPeakRSS/vcpus=16/app=state4k/cpu=1-16           58.08Mi ± 0%   57.96Mi ± 0%   -0.19% (p=0.010 n=32)
RestoredSentryPssAnon/vcpus=16/cpu=1-16               9.855Mi ± 0%   9.463Mi ± 0%   -3.98% (p=0.000 n=32)
SentryPeakRSS/vcpus=16/app=state4k/cpu=unlimited-16   58.21Mi ± 0%   58.03Mi ± 0%   -0.31% (p=0.000 n=32)
RestoredSentryPssAnon/vcpus=16/cpu=unlimited-16       11.03Mi ± 1%   10.59Mi ± 1%   -3.93% (p=0.000 n=32)
SentryPeakRSS/vcpus=16/app=bigheap/cpu=unlimited-16   640.9Mi ± 0%   715.2Mi ± 0%  +11.60% (p=0.000 n=32)
SentryPeakRSS/vcpus=16/app=bigheap/cpu=0.25-16        640.8Mi ± 0%   715.6Mi ± 0%  +11.67% (p=0.000 n=32)
geomean                                               21.37Mi        21.01Mi        -1.69%

Note on bigheap memory cap tradeoff:

  • pkg/gccontrol bounds unconstrained suspension at 1 GiB, whereas the
    reference branches cap save at 2x used and restore at 256 MiB (which
    resumes GC mid-save/restore on bigheap). Keeping GC suspended through
    bigheap trades +11.6% (~74 MiB) SentryPeakRSS and +5.18% (~44 ms)
    cpu=unlimited restore for -28.75% faster checkpoint and -11.72% faster
    restore under cpu=0.25.

3. //test/benchmarks/base (n=32 via Docker)

goos: linux
goarch: amd64
pkg: gvisor.dev/gvisor/test/benchmarks/base
                                                │    before    │                after                 │
                                                │    sec/op    │    sec/op      vs base               │
StartupEmpty-16                                   352.6m ± 34%    294.2m ± 22%       ~ (p=1.000 n=32)
StartupNginx-16                                   577.9m ±  2%    578.3m ±  2%       ~ (p=0.744 n=32)
StartupNode-16                                    904.3m ±  1%    904.1m ±  1%       ~ (p=0.878 n=32)
CheckpointEmpty-16                                64.52m ±  3%    66.47m ±  2%  +3.02% (p=0.037 n=32)
RestoreEmpty-16                                   169.5m ±  3%    174.1m ±  4%       ~ (p=0.500 n=32)
CheckpointNginx-16                                98.83m ±  2%   100.33m ±  2%       ~ (p=0.270 n=32)
RestoreNginx-16                                   228.4m ±  1%    229.5m ±  2%       ~ (p=0.492 n=32)
SizeNginx-16                                       1.270 ±  1%     1.276 ±  1%       ~ (p=0.419 n=32)
SizeNode-16                                        2.096 ±  1%     2.099 ±  2%       ~ (p=0.674 n=32)
SizeEmpty-16                                       1.300 ±  1%     1.298 ±  0%       ~ (p=0.580 n=32)
SizeEmpty/benchtime=10x-16                         2.114 ±  0%     2.113 ±  0%       ~ (p=0.419 n=32)
Syscallbench/benchtime.1x/syscall.getpid-16       12.27m ±  4%    12.42m ±  4%       ~ (p=0.103 n=32)
Syscallbench/benchtime.1x/syscall.getpidopt-16    12.09m ±  6%    12.05m ±  4%       ~ (p=0.795 n=32)
Syscallbench/syscall.getpid-16                    2.582µ ±  1%    2.587µ ±  3%       ~ (p=0.925 n=32)
Syscallbench/syscall.getpidopt-16                 1.169µ ±  6%    1.215µ ±  7%       ~ (p=0.237 n=32)
Hackbench/ipcMode.pipe/processMode.thread-16      167.4m ±  4%    169.5m ±  3%       ~ (p=0.847 n=32)
Hackbench/ipcMode.socket/processMode.process-16   646.1m ±  1%    648.0m ±  1%       ~ (p=0.300 n=32)
Sysbench/testname.CPU-16                          282.2m ±  2%    279.8m ±  2%       ~ (p=0.412 n=32)
Sysbench/testname.CPU/threads.16-16               282.2m ±  2%    279.2m ±  3%       ~ (p=0.206 n=32)
Sysbench/testname.Memory-16                        1.307 ±  1%     1.308 ±  0%       ~ (p=0.868 n=32)
Sysbench/testname.Memory/threads.16-16             1.267 ±  1%     1.266 ±  0%       ~ (p=0.608 n=32)
Sysbench/testname.Mutex-16                        278.1m ±  2%    280.9m ±  3%       ~ (p=0.500 n=32)
geomean                                           108.4m          108.2m        -0.21%

                           │                before                │                            after                            │
                           │ average_container_memory_usage.bytes │ average_container_memory_usage.bytes  vs base               │
SizeEmpty-16                                          12.97M ± 2%                            12.56M ± 2%  -3.22% (p=0.005 n=32)
SizeEmpty/benchtime=10x-16                            12.42M ± 0%                            12.19M ± 1%  -1.90% (p=0.000 n=32)
geomean                                               12.69M                                 12.37M       -2.56%

@parth-opensrc

Copy link
Copy Markdown
Member Author

Will squash the commits once approved

@konstantin-s-bogom konstantin-s-bogom 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.

Can you explain the regressions, like

Restore/vcpus=16/app=bigheap/cpu=unlimited-16          937.0m ±  1%   975.1m ±  1%   +4.06% (p=0.000 n=8)

@konstantin-s-bogom konstantin-s-bogom 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.

Fix the PR description, it still mentions --suspend-lifecycle-gc

Comment thread pkg/garbage/garbage.go Resolved
Comment thread pkg/garbage/garbage.go Resolved
Comment thread pkg/garbage/garbage_test.go Resolved
Comment thread pkg/sentry/state/state.go Resolved
Comment thread runsc/boot/loader.go Resolved
Comment thread runsc/boot/loader_test.go Resolved
Comment thread runsc/boot/restore.go Resolved
Comment thread runsc/cmd/sentry/sentrycmd/boot.go Resolved
@parth-opensrc
parth-opensrc force-pushed the pr-suspend-gc branch 3 times, most recently from 9b62a57 to 9d3e651 Compare October 30, 2026 22:05
Comment thread pkg/garbage/garbage.go Resolved
Comment thread runsc/boot/restore.go Resolved
Comment thread runsc/boot/restore.go Resolved
@parth-opensrc

Copy link
Copy Markdown
Member Author

Can you explain the regressions, like

Restore/vcpus=16/app=bigheap/cpu=unlimited-16          937.0m ±  1%   975.1m ±  1%   +4.06% (p=0.000 n=8)
image

Profiled the benchmark, with more free cores, it seems that with GC enabled pages can be reused, but when disabled, the new pages need to be allocated and that increases the PageFaults; although it's still only 613ms across 3 runs. When we have fewer cores free, perf increased because the sentry doesn't need to fight GC for cpu scheduling.

@parth-opensrc
parth-opensrc force-pushed the pr-suspend-gc branch 3 times, most recently from 7eccf74 to 874db9f Compare October 31, 2026 09:49
kerumeto
kerumeto previously approved these changes Nov 1, 2026
Comment thread runsc/boot/restore.go Resolved
Comment thread pkg/gccontrol/gccontrol_test.go Resolved
Comment thread pkg/sentry/state/state_test.go Resolved
Comment thread pkg/sentry/state/state_test.go Resolved
@parth-opensrc parth-opensrc added ready to pull Causes the PR to be imported into Google. Will be removed soon. and removed ready to pull Causes the PR to be imported into Google. Will be removed soon. labels Nov 1, 2026

@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.

I don't review the code changes, just read benchmark results, one question I have is that, what is the baseline for your benchmark, like which commit?

It never compares against the reference patches. Both linked issues (#16134 and #16152) ask for results that beat a reference patch, but the PR only compares against master. Going by the posted numbers alone, it doesn't clearly beat them:
- Restore at cpu=1: −4.6% here, against −20.7% for the reference.
- Large-heap peak memory: +12% here; the #16152 reference made it go down by 1.6–6.1%.
- Base suite: the reference showed small but significant startup, restore and checkpoint gains; this PR shows none.

The reference capped the heap at about 2× current use; this PR lets it grow to 1 GiB, and on a non-resuming save keeps GC off for another 500 ms.

Meanwhile, there are multiple regression

  • Sentry peak memory during checkpoint goes up by about 5% on the small workload and by 75 MiB (+12%) on the large one.
  • Idle memory after restore goes up 5%.
  • Large-heap restore with no CPU quota is 4% slower.

On the benchmark itself, n=8 may have too much noise, can you run with n=32+ or p<0.01?

We will need more investigation on the PR I believe to figure out whether or not this change is needed.

cc: @EtiennePerot

@parth-opensrc

Copy link
Copy Markdown
Member Author

± 0% +11.6

I don't review the code changes, just read benchmark results, one question I have is that, what is the baseline for your benchmark, like which commit?

It never compares against the reference patches. Both linked issues (#16134 and #16152) ask for results that beat a reference patch, but the PR only compares against master. Going by the posted numbers alone, it doesn't clearly beat them: - Restore at cpu=1: −4.6% here, against −20.7% for the reference. - Large-heap peak memory: +12% here; the #16152 reference made it go down by 1.6–6.1%. - Base suite: the reference showed small but significant startup, restore and checkpoint gains; this PR shows none.

The reference capped the heap at about 2× current use; this PR lets it grow to 1 GiB, and on a non-resuming save keeps GC off for another 500 ms.

Meanwhile, there are multiple regression

  • Sentry peak memory during checkpoint goes up by about 5% on the small workload and by 75 MiB (+12%) on the large one.
  • Idle memory after restore goes up 5%.
  • Large-heap restore with no CPU quota is 4% slower.

On the benchmark itself, n=8 may have too much noise, can you run with n=32+ or p<0.01?

We will need more investigation on the PR I believe to figure out whether or not this change is needed.

cc: @EtiennePerot

The original benchmarks were against origin/master (0bbcbf9de762, which already includes several merged lightspeed changes). Also I had some extra changes after that, and re-ran the benchmarks.

Added an n=32 comparison against the combined #16134 + #16152 reference branches on base 0bbcbf9de762 to the PR description.

The reference capped the heap at about 2× current use; this PR lets it grow to 1 GiB, and on a non-resuming save keeps GC off for another 500 ms.

gccontrol bounds suspension by remainingCgroup / 2 (capped at 1 GiB when unconstrained), and resumeOnGC re-enables GC if that limit triggers; on a non-resuming save, the 500 ms delay only covers Sentry teardown as the process exits.

Comment thread pkg/sentry/state/state.go Outdated
if v, err := strconv.ParseUint(metadata[metadataMemoryFileUsedBytesKey], 10 /* base */, 64 /* bitSize */); err == nil {
savedMemoryFileBytes = v
}
return gccontrol.Suspend(totalMemoryLimit(), savedMemoryFileBytes)

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.

@parth-opensrc, this uses the limit from sandbox creation. If the user lowers the limit before restore, the kernel enforces the new value but GC still budgets against the old one.

I saved the existing 50,000-file workload under 2 GiB in both cases and restored it with memory.max at 200 MiB. Creating the restore sandbox at 200 MiB gave Go a 99.93 MiB limit and restore succeeded. Creating it at 2 GiB and lowering it with Container.Update before Restore gave Go a 1,023 MiB limit. The restore RPC returned EOF and memory.events recorded one OOM kill, versus zero in the control. The test output and cgroup counters are from the same run.

On the earlier revision, reading the limit when the host sends Restore let both restores finish with a Go limit of about 99 MiB and no OOM kills. Could Sandbox.Restore and Sandbox.Checkpoint pass the current effective cgroup limit with the RPC? The guest /proc checkpoint starts SaveAsync inside the Sentry. When that path has no fresh host limit, it could keep ordinary GC enabled.

Posted by Codex on behalf of @tamird.

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.

@parth-opensrc, I reran your unchanged TestRestoreCgroupMemoryLimit on a48b7a12c. Both createAtLimit (200 MiB at creation) and lowerBeforeRestore (2 GiB lowered to 200 MiB) passed. In each case memory.events reported oom_kill 0, and the restored process could access /tmpfs. That addresses the resize failure I reported here. Test results.

Posted by Codex on behalf of @tamird.

defer cont2.Destroy()

if err := cont2.Restore(conf, imageDir, sandbox.DirectIOOff, false /* background */, nil /* networkArgs */); err != nil {
events, _ := os.ReadFile(probe.MakePath("memory.events"))

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.

@parth-opensrc, on cgroup v2, MakePath takes a controller name and returns the cgroup directory regardless of that argument 1. Both Stat calls here therefore succeed as long as the directory exists, even if memory.swap.max is missing. The failure diagnostic later tries to ReadFile the directory, too, so it drops the OOM counters when restore fails.

Could these use filepath.Join(probe.MakePath(""), "memory.max") (and similarly for memory.swap.max and memory.events)? That makes the optional swap check and the OOM report inspect the intended files. If skipping systems without the memory controller is required, Install can itself fail before these checks.

There is a second reason to read those counters on failure: with the 200 MiB cap applied during fixture setup, the sentry was OOM-killed during Save before this test reached Restore. The same happened with ordinary GC; on this worker the proposed policy declined to suspend anyway. Giving only the checkpoint writer 2 GiB let the restore assertion run against a real 200 MiB cap.

Posted by Codex on behalf of @tamird.

if totalMem == 0 {
totalMem = gccontrol.NoMemoryLimit
}
s := gccontrol.Suspend(totalMem, 0 /* untrackedMem */)

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.

@parth-opensrc, b.totalMem can be larger than the cgroup limit Linux enforces. On the earlier revision I set a parent’s memory.max to 512 MiB and its child’s to 2 GiB. The cgroup reader returned 2 GiB, and Suspend set Go’s soft memory limit to 1 GiB. It did the same with two unlimited levels below the 512 MiB parent. A 256 MiB child correctly got a 128 MiB Go limit.

Could we land #16767 before relying on this value to suspend GC? It fixes the shared cgroup reader. Taking the smallest visible limit gave the first two cases a 256 MiB Go limit and left the control unchanged. Results from a real cgroup-v2 hierarchy. These measure the limit passed to Go; no workload was driven to OOM.

Posted by Codex on behalf of @tamird.

@EtiennePerot
EtiennePerot dismissed kerumeto’s stale review November 3, 2026 01:52

[🤖] Invalidating approval due to rebase as a means to notify @kerumeto to re-review. Current diff looks different from pre-rebase diff.

@EtiennePerot EtiennePerot removed the ready to pull Causes the PR to be imported into Google. Will be removed soon. label Nov 3, 2026
@EtiennePerot
EtiennePerot requested a review from kerumeto November 3, 2026 01:52
@EtiennePerot

Copy link
Copy Markdown
Member

[🤖] Invalidating approval due to rebase as a means to notify @kerumeto to re-review. Current diff looks different from pre-rebase diff.

@tamird

tamird commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

@parth-opensrc, I reran the 100,000-file tmpfs checkpoint on c31b2ad and its parent 706b124. The earlier 30.12% increase in peak Sentry RSS was on a48b7a1. On this revision, peak RSS was 1.33% higher than on its parent, and save took 3.98% longer.

The run used the graph engine without compression, native AMD64 systrap, four CPUs and a 2 GiB limit. Both revisions restored all 100,000 files from every checkpoint, including the warmups.

                        │   parent    │             candidate              │
                        │   sec/op    │   sec/op     vs base               │
Save/checkpoint_ns        473.1m ± 1%   491.9m ± 1%  +3.98% (p=0.000 n=12)
Save/checkpoint_exit_ns   536.2m ± 1%   555.7m ± 1%  +3.64% (p=0.000 n=12)

                            │    parent    │              candidate              │
                            │     B/op     │     B/op      vs base               │
Save/observed_save_exit_rss   424.3Mi ± 2%   429.9Mi ± 2%  +1.33% (p=0.000 n=12)

The time rows measure return from checkpoint and exit of the saving Sentry. The RSS row measures the peak sampled through exit. Measurements and restore results · Full benchstat

Earlier revisions

I tried a non-resuming checkpoint with the graph state engine, now the default on master. On 100,000 empty tmpfs files, the PR took longer to save and used more memory than its parent.

I used systrap on Linux/amd64, four CPUs, no sandbox CPU quota, a 2 GiB memory limit, and uncompressed checkpoints. Each column has 12 measured saves after one warmup, in balanced order. The columns are the parent (0bbcbf9de), the #16152 save-only reference (79637cb45), and this PR (a48b7a12c). Both deltas are relative to the parent.

Save/checkpoint_ns                                               354.4m ± 2%                    360.2m ± 4%       ~ (p=0.143 n=12)                   366.8m ± 4%  +3.50% (p=0.020 n=12)
Save/checkpoint_exit_ns                                          426.7m ± 2%                    432.1m ± 3%       ~ (p=0.319 n=12)                   447.3m ± 4%  +4.81% (p=0.001 n=12)
Save/observed_save_exit_rss                                         427.1Mi ± 1%                   430.4Mi ± 0%       ~ (p=0.101 n=12)                 555.8Mi ± 0%  +30.12% (p=0.000 n=12)

The first two rows are time to checkpoint return and to Sentry exit (m = milliseconds). The last is peak sampled Sentry RSS over that interval. All 39 archives contained graph frames and restored all 100,000 files. Full benchstat and results.

Which state engine and compression setting did your C4 bigheap runs use? That would let us compare the same save path across the two workloads.

Posted by Codex on behalf of @tamird.

@kerumeto kerumeto 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.

[🤖🐸🤖] 5 issues found:

  • [major · bug] Guest-triggered checkpoint suspends GC with stale boot memory limit, causing cgroup OOM kill (runsc/boot/restore.go:173, inline)
  • [major · bug] Subcontainer restore via StartSubcontainer drops MemoryLimit and retains stale cgroup limit (runsc/sandbox/sandbox.go:539, details below)
  • [major · bug] GC budget ignores ancestor cgroup limits; restore is OOM-killed (runsc/sandbox/sandbox.go:608, inline)
  • [minor · bug] Loader.run evaluates gccontrol.Suspend before ending the boot startupGC handle (runsc/boot/loader.go:1479, inline)
  • [minor · bug] Loader.saveWithOpts does not end l.startupGC before checkpoint save (runsc/boot/restore.go:891, details below)

runsc/sandbox/sandbox.go:539

[🤖🐸🤖] [major · bug] Subcontainer restore via StartSubcontainer drops MemoryLimit and retains stale cgroup limit

In multi-container pod restore, the root container runs Restore while subcontainers commonly run Start (Sandbox.StartSubcontainer), which the Sentry translates to RestoreSubcontainer while in restoringUnstarted state. Sandbox.StartSubcontainer omits MemoryLimit: s.effectiveMemoryLimit(), sending 0, and restorer.restoreContainerInfo ignores memoryLimit == 0 (if memoryLimit > 0). As a result, if Container.Update lowers the pod cgroup memory.max between rootCont.Restore and subCont.Start, restore suspends Go GC with the stale root limit and triggers a host cgroup OOM kill. Ignoring 0 also prevents RestoreSubcontainer from falling back to ordinary GC when effectiveMemoryLimit() returns 0 (unlimited or read error).

Suggested fix: Set MemoryLimit: s.effectiveMemoryLimit() in Sandbox.StartSubcontainer (runsc/sandbox/sandbox.go:547) and assign r.memoryLimit = memoryLimit unconditionally in restorer.restoreContainerInfo (runsc/boot/restore.go:345-347).

Details (evidence, reproduction and test code)

Evidence: containerManager.StartSubcontainer (runsc/boot/controller.go:217-221) delegates to cm.RestoreSubcontainer(args, nil) when state == restoringUnstarted (a path this PR updated at runsc/boot/controller.go:703-705 to guard reply != nil). While Sandbox.RestoreSubcontainer sets MemoryLimit: s.effectiveMemoryLimit() (runsc/sandbox/sandbox.go:862), Sandbox.StartSubcontainer (runsc/sandbox/sandbox.go:539-548) leaves args.MemoryLimit == 0. restorer.restoreContainerInfo (runsc/boot/restore.go:345-347) then guards if memoryLimit > 0 { r.memoryLimit = memoryLimit }, keeping r.memoryLimit from rootCont.Restore (2 GiB -> GOMEMLIMIT = 1 GiB) even after rootCont.Update lowered memory.max to 200 MiB, or when a later effectiveMemoryLimit() call returns 0 (runsc/sandbox/sandbox.go:609-610).

Reproduced with a test (runsc/container/container_save_restore_test.go): bazel test //runsc/container:container_test --test_filter=TestSubcontainerRestoreCgroupMemoryLimit --strategy=TestRunner=local --test_sharding_strategy=disabled --test_timeout=60 --nocache_test_results → TestSubcontainerRestoreCgroupMemoryLimit checkpoints a 2-container sandbox under a 2 GiB cgroup limit, calls rootCont.Restore, lowers memory.max to 200 MiB via rootCont.Update, and restores the second container via subCont.Start. It fails on PR head with oom_kill 1, and passes (oom_kill 0) with the suggested fix.

Test code:

diff --git a/runsc/container/container_save_restore_test.go b/runsc/container/container_save_restore_test.go
index 040c7dafa..b67247253 100644
--- a/runsc/container/container_save_restore_test.go
+++ b/runsc/container/container_save_restore_test.go
@@ -3033,3 +3033,364 @@ func TestRestoreCgroupMemoryLimit(t *testing.T) {
 		})
 	}
 }
+
+func probeWritableMemoryCgroupV2(t *testing.T) (newCgPath func(string) string, makeMemRes func(int64) *specs.LinuxMemory) {
+	t.Helper()
+	if sync.RaceEnabled {
+		t.Skip("Skipping test when running with race detector (gotsan)")
+	}
+	if os.Getpagesize() > 4096 {
+		t.Skip("4K page size required for 200 MiB cgroup RSS budget")
+	}
+	if !cgroup.IsOnlyV2() {
+		t.Skip("cgroup v2 required")
+	}
+
+	parentCg := "/"
+	if selfCg, err := os.ReadFile("/proc/self/cgroup"); err == nil {
+		for line := range strings.SplitSeq(strings.TrimSpace(string(selfCg)), "\n") {
+			if rel, ok := strings.CutPrefix(line, "0::"); ok {
+				parentCg = filepath.Dir(filepath.Clean("/" + rel))
+				break
+			}
+		}
+	}
+	newCgPath = func(prefix string) string {
+		return filepath.Join(parentCg, testutil.RandomID(prefix))
+	}
+
+	cgPath := newCgPath("gvisor-test-cg-probe")
+	probe, err := cgroup.NewFromPath(cgPath, false /* useSystemd */)
+	if err != nil {
+		t.Skipf("cgroup v2 unavailable: %v", err)
+	}
+	if err := probe.Install(&specs.LinuxResources{}); err != nil {
+		if errors.Is(err, os.ErrPermission) || errors.Is(err, unix.EROFS) || errors.Is(err, unix.EBUSY) {
+			t.Skipf("writable cgroup v2 hierarchy unavailable: %v", err)
+		}
+		t.Fatalf("probe.Install(): %v", err)
+	}
+	probeInstalled := true
+	defer func() {
+		if probeInstalled {
+			_ = probe.Uninstall()
+		}
+	}()
+	if _, err := os.Stat(filepath.Join(probe.MakePath(""), "memory.max")); err != nil {
+		if os.IsNotExist(err) {
+			t.Skip("cgroup v2 memory controller unavailable")
+		}
+		t.Fatalf("Stat(memory.max): %v", err)
+	}
+	_, swapErr := os.Stat(filepath.Join(probe.MakePath(""), "memory.swap.max"))
+	probeInstalled = false
+	if err := probe.Uninstall(); err != nil {
+		t.Fatalf("probe.Uninstall(): %v", err)
+	}
+
+	makeMemRes = func(limit int64) *specs.LinuxMemory {
+		res := &specs.LinuxMemory{Limit: &limit}
+		if swapErr == nil {
+			res.Swap = &limit
+		}
+		return res
+	}
+	return newCgPath, makeMemRes
+}
+
+func requireNoOOMKill(t *testing.T, eventsPath string) {
+	t.Helper()
+	events, err := os.ReadFile(eventsPath)
+	if err != nil {
+		t.Fatalf("ReadFile(%q): %v", eventsPath, err)
+	}
+	for line := range strings.SplitSeq(string(events), "\n") {
+		if line == "oom_kill 0" {
+			return
+		}
+	}
+	t.Fatalf("unexpected OOM kill in memory.events:\n%s", events)
+}
+
+// TestGuestCheckpointCgroupMemoryLimit verifies that a guest-triggered
+// checkpoint via /proc/gvisor/checkpoint does not cause a host cgroup OOM kill
+// after Container.Update lowers the sandbox memory cgroup limit below the
+// boot-time limit.
+func TestGuestCheckpointCgroupMemoryLimit(t *testing.T) {
+	newCgPath, makeMemRes := probeWritableMemoryCgroupV2(t)
+	testAppPath, err := testutil.FindFile("test/cmd/test_app/test_app")
+	if err != nil {
+		t.Fatalf("FindFile(test_app): %v", err)
+	}
+
+	const (
+		initialMemLimit    = int64(2 << 30)
+		checkpointMemLimit = int64(400 << 20)
+	)
+
+	imageDir := makeTempDir(t, "guest-ckpt-img")
+	ctrlDir := makeTempDir(t, "guest-ckpt-ctrl")
+	triggerFile := filepath.Join(ctrlDir, "trigger")
+	doneFile := filepath.Join(ctrlDir, "done")
+
+	script := fmt.Sprintf(
+		"mkdir -p /tmpfs/live /tmpfs/tmp && while [ ! -f %q ]; do sleep 0.05; done; exec 3<>/proc/gvisor/checkpoint; echo 1 >&3; cat <&3 > %q; sleep 1000",
+		triggerFile, doneFile,
+	)
+	spec := testutil.NewSpecWithArgs("/bin/sh", "-c", script)
+	conf := testutil.TestConfig(t)
+	conf.Overlay2.Set("none")
+	conf.Strace = false
+	spec.Mounts = []specs.Mount{
+		{Type: "tmpfs", Destination: "/tmpfs"},
+		{Type: "bind", Source: ctrlDir, Destination: ctrlDir},
+	}
... (249 more lines in the full patch)

runsc/boot/restore.go:891

[🤖🐸🤖] [minor · bug] Loader.saveWithOpts does not end l.startupGC before checkpoint save

Unlike containerManager.Restore, Loader.saveWithOpts does not end l.startupGC before calling state.SaveWithOpts. If a checkpoint save runs while the startup or post-restore startupGC handle is still open (before the 250ms idle release or 500ms fallback timer expires), state.Save's gccontrol.Suspend shares l.startupGC's session:

  1. On a resuming (Resume: true) or failed save, finishSaveGCSuspension calls gcSuspension.End(), but l.startupGC's open reference keeps GC disabled (GCPercent = -1) after saveWithOpts returns.
  2. When saveOpts.MemoryLimit == 0 (unknown bound), Suspend(0, ...) returns nil without ending the active session, leaving GC disabled under l.startupGC's limit during save.
  3. If l.startupGC resumed early (stateResumed), Suspend does not re-suspend GC for the save even when sufficient headroom exists.

Suggested fix: End l.startupGC at the start of Loader.saveWithOpts:

	l.saveMu.Lock()
	defer l.saveMu.Unlock()
	l.startupGC.Swap(nil).End()
Details (evidence, reproduction and test code)

Evidence: Loader.saveWithOpts (runsc/boot/restore.go:891-949) calls state.SaveWithOpts without calling l.startupGC.Swap(nil).End() (unlike containerManager.Restore at runsc/boot/controller.go:381). In pkg/sentry/state/state.go:181-184, SaveOpts.Save calls gcSuspension := gccontrol.Suspend(opts.MemoryLimit, memoryFileBytes) and defers finishSaveGCSuspension(gcSuspension, opts.Resume, err). When l.startupGC is still open (current.refs == 1), Suspend increments current.refs to 2 (or hits stateResumed / totalMem == 0), so gcSuspension.End() only decrements current.refs from 2 to 1 instead of calling resumeGCLocked().

Reproduced with a test (runsc/boot/BUILD, runsc/boot/loader_test.go): bazel test //runsc/boot:boot_test --test_filter=TestStartupGC/resumesStartupGCOnSave --nocache_test_results → Fails at PR head with GCPercent after saveWithOpts = -1, want >= 0; passes when l.startupGC.Swap(nil).End() is called in Loader.saveWithOpts.

Test code:

diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD
index 5cac89345..b89aa7420 100644
--- a/runsc/boot/BUILD
+++ b/runsc/boot/BUILD
@@ -201,9 +201,11 @@ go_test(
         "//pkg/log",
         "//pkg/seccomp",
         "//pkg/sentry/checkpoint",
+        "//pkg/sentry/control/controlapi",
         "//pkg/sentry/fscheckpoint",
         "//pkg/sentry/kernel",
         "//pkg/sentry/kernel/auth",
+        "//pkg/sentry/state",
         "//pkg/sentry/vfs",
         "//pkg/sync",
         "//pkg/unet",
diff --git a/runsc/boot/loader_test.go b/runsc/boot/loader_test.go
index 785b77d91..820d19de0 100644
--- a/runsc/boot/loader_test.go
+++ b/runsc/boot/loader_test.go
@@ -16,6 +16,7 @@ package boot
 
 import (
 	"fmt"
+	"io"
 	"math"
 	"math/rand"
 	"net"
@@ -37,8 +38,10 @@ import (
 	"gvisor.dev/gvisor/pkg/gccontrol"
 	"gvisor.dev/gvisor/pkg/lisafs"
 	"gvisor.dev/gvisor/pkg/log"
+	"gvisor.dev/gvisor/pkg/sentry/control/controlapi"
 	"gvisor.dev/gvisor/pkg/sentry/kernel"
 	"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
+	"gvisor.dev/gvisor/pkg/sentry/state"
 	"gvisor.dev/gvisor/pkg/sentry/vfs"
 	"gvisor.dev/gvisor/pkg/sync"
 	"gvisor.dev/gvisor/pkg/unet"
@@ -520,6 +523,46 @@ func TestStartupGC(t *testing.T) {
 			t.Fatalf("GCPercent after restore run = %d, want >= 0", got)
 		}
 	})
+
+	t.Run("suspendsOnStartAfterEarlyBootResume", func(t *testing.T) {
+		l, _ := newSuspendedLoader(t)
+		// Simulate GC running during boot.New before StartRoot arrives, which
+		// transitions the boot suspension session to stateResumed.
+		runtime.GC()
+		deadline := time.Now().Add(5 * time.Second)
+		for time.Now().Before(deadline) {
+			if gcPercent() != gcDisabled {
+				break
+			}
+			time.Sleep(time.Millisecond)
+		}
+		if got := gcPercent(); got == gcDisabled {
+			t.Fatal("GC remained disabled after forced collection during boot")
+		}
+		if err := l.run(); err != nil {
+			t.Fatalf("l.run() in state=created: %v", err)
+		}
+		got := gcPercent()
+		l.WaitExit()
+		if got >= 0 {
+			t.Fatalf("GCPercent after l.run() = %d, want < 0", got)
+		}
+	})
+
+	t.Run("resumesStartupGCOnSave", func(t *testing.T) {
+		l, _ := newSuspendedLoader(t)
+		pr, pw := io.Pipe()
+		pr.Close()
+		defer pw.Close()
+		_ = l.saveWithOpts(&state.SaveOpts{
+			Destination: pw,
+			Resume:      true,
+			MemoryLimit: gccontrol.NoMemoryLimit,
+		}, &controlapi.SaveRestoreExecOpts{})
+		if got := gcPercent(); got < 0 {
+			t.Fatalf("GCPercent after saveWithOpts = %d, want >= 0", got)
+		}
+	})
 }
 
 // Test that network=host with raw sockets enabled requires CAP_NET_RAW on the

Automated review agent. Please address valid findings before human review, or close them with a reason.

Comment thread runsc/boot/restore.go
Resume: specutils.AnnotationToBool(spec, annotationCheckpointResume),
CudaCheckpointSequential: specutils.AnnotationToBool(spec, annotationCheckpointCudaCheckpointSequential),
MemoryLimit: configuredMemoryLimit(),
}

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.

[🤖🐸🤖] [major · bug] Guest-triggered checkpoint suspends GC with stale boot memory limit, causing cgroup OOM kill

When a checkpoint is triggered from inside the sandbox via /proc/gvisor/checkpoint, saveOptsFromSpec sets SaveOpts.MemoryLimit to configuredMemoryLimit(), which reads the static --total-memory flag passed at sandbox boot (previously raised by @tamird). Because the chrooted Sentry process cannot observe host cgroup reductions later applied via Container.Update, a guest-triggered checkpoint after lowering memory.max suspends Go GC (GOGC = -1) under a stale soft memory limit (GOMEMLIMIT = initialLimit / 2). Uncollected heap garbage and transient state.Save allocations then accumulate without triggering GC until the host kernel OOM-kills the Sentry.

Suggested fix: Remove MemoryLimit: configuredMemoryLimit() from saveOptsFromSpec (runsc/boot/restore.go:182) so SaveOpts.MemoryLimit remains 0 and ordinary Go GC stays active on the Loader.SaveAsync path.

Details (evidence, reproduction and test code)

Evidence: Loader.SaveAsync() (runsc/boot/restore.go:134-147) builds controlapi.SaveOpts via saveOptsFromSpec, which sets MemoryLimit: configuredMemoryLimit() (runsc/boot/restore.go:182), reading totalMemoryFlag (runsc/boot/restore.go:412-417). Loader.save (runsc/boot/loader.go:1710-1718) passes o.MemoryLimit to state.SaveOpts.SuspendGCMemoryLimit, calling gccontrol.Default.Suspend(opts.MemoryLimit/2, 0) (pkg/sentry/state/state.go:97-100). Meanwhile, Container.Update (runsc/container/container.go:733-764) lowers host cgroup memory.max in place without updating totalMemoryFlag. Prior to this PR, SaveAsync kept GOGC = 100 active and reclaimed unreachable heap allocations before exceeding the lowered cgroup limit.

Reproduced with a test (runsc/container/container_save_restore_test.go): bazel test //runsc/container:container_test --test_filter=TestGuestCheckpointCgroupMemoryLimit --strategy=TestRunner=local --test_sharding_strategy=disabled --test_timeout=60 --nocache_test_results → TestGuestCheckpointCgroupMemoryLimit boots under a 2 GiB cgroup limit, creates live and unlinked tmpfs files, lowers memory.max to 400 MiB via Container.Update, and triggers /proc/gvisor/checkpoint. It fails on PR head with a host cgroup OOM kill (oom_kill 1), and passes (oom_kill 0) both at the merge-base and with MemoryLimit omitted in saveOptsFromSpec.

Test code:

diff --git a/runsc/container/container_save_restore_test.go b/runsc/container/container_save_restore_test.go
index 040c7dafa..b67247253 100644
--- a/runsc/container/container_save_restore_test.go
+++ b/runsc/container/container_save_restore_test.go
@@ -3033,3 +3033,364 @@ func TestRestoreCgroupMemoryLimit(t *testing.T) {
 		})
 	}
 }
+
+func probeWritableMemoryCgroupV2(t *testing.T) (newCgPath func(string) string, makeMemRes func(int64) *specs.LinuxMemory) {
+	t.Helper()
+	if sync.RaceEnabled {
+		t.Skip("Skipping test when running with race detector (gotsan)")
+	}
+	if os.Getpagesize() > 4096 {
+		t.Skip("4K page size required for 200 MiB cgroup RSS budget")
+	}
+	if !cgroup.IsOnlyV2() {
+		t.Skip("cgroup v2 required")
+	}
+
+	parentCg := "/"
+	if selfCg, err := os.ReadFile("/proc/self/cgroup"); err == nil {
+		for line := range strings.SplitSeq(strings.TrimSpace(string(selfCg)), "\n") {
+			if rel, ok := strings.CutPrefix(line, "0::"); ok {
+				parentCg = filepath.Dir(filepath.Clean("/" + rel))
+				break
+			}
+		}
+	}
+	newCgPath = func(prefix string) string {
+		return filepath.Join(parentCg, testutil.RandomID(prefix))
+	}
+
+	cgPath := newCgPath("gvisor-test-cg-probe")
+	probe, err := cgroup.NewFromPath(cgPath, false /* useSystemd */)
+	if err != nil {
+		t.Skipf("cgroup v2 unavailable: %v", err)
+	}
+	if err := probe.Install(&specs.LinuxResources{}); err != nil {
+		if errors.Is(err, os.ErrPermission) || errors.Is(err, unix.EROFS) || errors.Is(err, unix.EBUSY) {
+			t.Skipf("writable cgroup v2 hierarchy unavailable: %v", err)
+		}
+		t.Fatalf("probe.Install(): %v", err)
+	}
+	probeInstalled := true
+	defer func() {
+		if probeInstalled {
+			_ = probe.Uninstall()
+		}
+	}()
+	if _, err := os.Stat(filepath.Join(probe.MakePath(""), "memory.max")); err != nil {
+		if os.IsNotExist(err) {
+			t.Skip("cgroup v2 memory controller unavailable")
+		}
+		t.Fatalf("Stat(memory.max): %v", err)
+	}
+	_, swapErr := os.Stat(filepath.Join(probe.MakePath(""), "memory.swap.max"))
+	probeInstalled = false
+	if err := probe.Uninstall(); err != nil {
+		t.Fatalf("probe.Uninstall(): %v", err)
+	}
+
+	makeMemRes = func(limit int64) *specs.LinuxMemory {
+		res := &specs.LinuxMemory{Limit: &limit}
+		if swapErr == nil {
+			res.Swap = &limit
+		}
+		return res
+	}
+	return newCgPath, makeMemRes
+}
+
+func requireNoOOMKill(t *testing.T, eventsPath string) {
+	t.Helper()
+	events, err := os.ReadFile(eventsPath)
+	if err != nil {
+		t.Fatalf("ReadFile(%q): %v", eventsPath, err)
+	}
+	for line := range strings.SplitSeq(string(events), "\n") {
+		if line == "oom_kill 0" {
+			return
+		}
+	}
+	t.Fatalf("unexpected OOM kill in memory.events:\n%s", events)
+}
+
+// TestGuestCheckpointCgroupMemoryLimit verifies that a guest-triggered
+// checkpoint via /proc/gvisor/checkpoint does not cause a host cgroup OOM kill
+// after Container.Update lowers the sandbox memory cgroup limit below the
+// boot-time limit.
+func TestGuestCheckpointCgroupMemoryLimit(t *testing.T) {
+	newCgPath, makeMemRes := probeWritableMemoryCgroupV2(t)
+	testAppPath, err := testutil.FindFile("test/cmd/test_app/test_app")
+	if err != nil {
+		t.Fatalf("FindFile(test_app): %v", err)
+	}
+
+	const (
+		initialMemLimit    = int64(2 << 30)
+		checkpointMemLimit = int64(400 << 20)
+	)
+
+	imageDir := makeTempDir(t, "guest-ckpt-img")
+	ctrlDir := makeTempDir(t, "guest-ckpt-ctrl")
+	triggerFile := filepath.Join(ctrlDir, "trigger")
+	doneFile := filepath.Join(ctrlDir, "done")
+
+	script := fmt.Sprintf(
+		"mkdir -p /tmpfs/live /tmpfs/tmp && while [ ! -f %q ]; do sleep 0.05; done; exec 3<>/proc/gvisor/checkpoint; echo 1 >&3; cat <&3 > %q; sleep 1000",
+		triggerFile, doneFile,
+	)
+	spec := testutil.NewSpecWithArgs("/bin/sh", "-c", script)
+	conf := testutil.TestConfig(t)
+	conf.Overlay2.Set("none")
+	conf.Strace = false
+	spec.Mounts = []specs.Mount{
+		{Type: "tmpfs", Destination: "/tmpfs"},
+		{Type: "bind", Source: ctrlDir, Destination: ctrlDir},
+	}
... (249 more lines in the full patch)

Automated review agent. Please address valid findings before human review, or close them with a reason.

Comment thread runsc/sandbox/sandbox.go
Comment on lines +608 to +626
// effectiveMemoryLimit reads the current host and cgroup memory bound because
// container updates can change the cgroup limit after sandbox creation. Returns
// zero if the bound cannot be read so ordinary GC remains enabled.
func (s *Sandbox) effectiveMemoryLimit() uint64 {
host, err := hostos.TotalSystemMemory()
if err != nil {
log.Warningf("Reading host memory limit: %v", err)
return 0
}
if s.CgroupJSON.Cgroup == nil {
return host
}
limit, err := s.CgroupJSON.Cgroup.MemoryLimit()
if err != nil {
log.Warningf("Reading cgroup memory limit: %v", err)
return 0
}
return min(host, limit)
}

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.

[🤖🐸🤖] [major · bug] GC budget ignores ancestor cgroup limits; restore is OOM-killed

Suspension budgets come from Cgroup.MemoryLimit() (here, and via --total-memory for boot). That reader only checks the sandbox cgroup and its direct parent. If the real limit is set two or more levels up, or a child has a larger limit than its parent, Suspend falls back to host memory and allows a 1 GiB Go heap with GC off. A restore under such a limit is OOM-killed by the kernel, but the same restore succeeds at the merge-base. Previously raised by @tamird; still present at the PR head.

Suggested fix: Do not size the GC suspension from a limit that may be too large. Make cgroupV2.MemoryLimit() return the smallest memory.max from the sandbox cgroup up to the cgroup root (as #16767 does), and land that before this PR. Alternatively, read /proc/self/cgroup in the Sentry and walk the ancestors there. Verified: an all-ancestors MemoryLimit() makes the reproducer pass and keeps TestRestoreCgroupMemoryLimit green.

Details (evidence, reproduction and test code)

Evidence: Setup: an ancestor cgroup with memory.max=200 MiB and memory.swap.max=0. The sandbox cgroup is ancestor/mid/leaf with no limits of its own. The checkpoint is the same 50,000-file tmpfs image that TestRestoreCgroupMemoryLimit uses.

  • cgroupV2.MemoryLimit() (runsc/cgroup/cgroup_v2.go:413) checks only leaf and mid, both max, and returns MaxUint64. effectiveMemoryLimit() then returns host RAM, and the restore sandbox boots with --total-memory 135161987072. gccontrol.Suspend therefore sets a 1 GiB soft limit for both the boot and the restore suspension.
  • PR head: containerManager.Restore failed: EOF: the sandbox exited before the container started. The ancestor memory.events shows oom_kill 1, and memory.peak is 209715200 (the limit).
  • Merge-base: the restore succeeds with oom_kill 0 and memory.peak 140980224 (about 134 MiB).
  • PR head plus an experimental reader fix that takes the minimum memory.max over all ancestors: MemoryLimit() returns 209715200, the restore succeeds with oom_kill 0 and peak about 139 MiB, and TestRestoreCgroupMemoryLimit still passes.

The same budget source feeds Sandbox.Checkpoint, so saves under such hierarchies can hit the same problem.

Reproduced with a test (runsc/container/container_save_restore_test.go): 'bazel test //runsc/container:container_test --test_filter=TestRestoreParentCgroupMemoryLimit --test_sharding_strategy=disabled --nocache_test_results --strategy=TestRunner=local --test_arg=-test.v --test_output=errors > /tmp/head-out.txt 2>&1; rc=$?; ...; exit $rc' (same command with --slot base on the merge-base) → Fails on the PR head: the restore is OOM-killed by the 200 MiB ancestor limit. Passes at the merge-base and with an all-ancestors cgroup reader fix applied.

Test code:

diff --git a/runsc/container/container_save_restore_test.go b/runsc/container/container_save_restore_test.go
index 040c7dafa..e7d9f7139 100644
--- a/runsc/container/container_save_restore_test.go
+++ b/runsc/container/container_save_restore_test.go
@@ -3033,3 +3033,175 @@ func TestRestoreCgroupMemoryLimit(t *testing.T) {
 		})
 	}
 }
+
+// TestRestoreParentCgroupMemoryLimit restores a checkpoint with a large Sentry
+// Go heap into a sandbox cgroup that has no memory limit of its own, nested
+// two levels below an ancestor cgroup limited to 200 MiB. The restore must not
+// be OOM-killed by the ancestor limit.
+func TestRestoreParentCgroupMemoryLimit(t *testing.T) {
+	if sync.RaceEnabled {
+		t.Skip("Skipping test when running with race detector (gotsan)")
+	}
+	if os.Getpagesize() > 4096 {
+		t.Skip("4K page size required for 200 MiB cgroup RSS budget")
+	}
+	if !cgroup.IsOnlyV2() {
+		t.Skip("cgroup v2 required")
+	}
+	testAppPath, err := testutil.FindFile("test/cmd/test_app/test_app")
+	if err != nil {
+		t.Fatalf("FindFile(test_app): %v", err)
+	}
+
+	parentCg := "/"
+	if selfCg, err := os.ReadFile("/proc/self/cgroup"); err == nil {
+		for line := range strings.SplitSeq(strings.TrimSpace(string(selfCg)), "\n") {
+			if rel, ok := strings.CutPrefix(line, "0::"); ok {
+				parentCg = filepath.Dir(filepath.Clean("/" + rel))
+				break
+			}
+		}
+	}
+	newCgPath := func(prefix string) string {
+		return filepath.Join(parentCg, testutil.RandomID(prefix))
+	}
+
+	const (
+		saveMemLimit    = int64(2 << 30)
+		restoreMemLimit = int64(200 << 20)
+	)
+
+	// Checkpoint with ample memory, same as TestRestoreCgroupMemoryLimit.
+	spec, conf := sleepSpecConf(t)
+	conf.Overlay2.Set("none")
+	conf.Strace = false
+	spec.Mounts = []specs.Mount{{Type: "tmpfs", Destination: "/tmpfs"}}
+	saveLimit := saveMemLimit
+	spec.Linux = &specs.Linux{
+		CgroupsPath: newCgPath("gvisor-test-cg"),
+		Resources:   &specs.LinuxResources{Memory: &specs.LinuxMemory{Limit: &saveLimit}},
+	}
+	_, bundleDir, cleanup, err := testutil.SetupContainer(spec, conf)
+	if err != nil {
+		t.Fatalf("SetupContainer: %v", err)
+	}
+	defer cleanup()
+	cont, err := New(conf, Args{ID: testutil.RandomContainerID(), Spec: spec, BundleDir: bundleDir})
+	if err != nil {
+		t.Fatalf("creating container: %v", err)
+	}
+	defer func() {
+		if cont != nil {
+			_ = cont.Destroy()
+		}
+	}()
+	if err := cont.Start(conf); err != nil {
+		t.Fatalf("starting container: %v", err)
+	}
+	if err := waitForProcessCount(cont, 1); err != nil {
+		t.Fatalf("waiting for init process: %v", err)
+	}
+	execFile, err := os.Open(testAppPath)
+	if err != nil {
+		t.Fatalf("Open(%q): %v", testAppPath, err)
+	}
+	ws, err := cont.executeSync(conf, &controlapi.ExecArgs{
+		Argv: []string{"test_app", "fsTreeCreate", "--target-dir=/tmpfs", "--depth=50", "--file-per-level=1000", "--file-size=0"},
+		FilePayload: controlapi.NewFilePayload(map[int]*os.File{
+			0: os.Stdin, 1: os.Stdout, 2: os.Stderr,
+		}, execFile),
+	})
+	execFile.Close()
+	if err != nil || !ws.Exited() || ws.ExitStatus() != 0 {
+		t.Fatalf("fsTreeCreate failed: ws=%v, err=%v", ws, err)
+	}
+	imageDir := t.TempDir()
+	if err := os.Chmod(imageDir, 0777); err != nil {
+		t.Fatalf("Chmod(%q): %v", imageDir, err)
+	}
+	if err := cont.Checkpoint(conf, imageDir, sandbox.CheckpointOpts{
+		Compression: statefile.CompressionLevelFlateBestSpeed,
+	}); err != nil {
+		t.Fatalf("checkpointing container: %v", err)
+	}
+	if _, err := cont.Wait(); err != nil {
+		t.Fatalf("waiting after checkpoint: %v", err)
+	}
+	if err := cont.Destroy(); err != nil {
+		t.Fatalf("destroying checkpointed container: %v", err)
+	}
+	cont = nil
+
+	// Ancestor cgroup with a 200 MiB limit. The sandbox cgroup is created two
+	// levels below it with no memory limit of its own.
+	ancestorRel := newCgPath("gvisor-test-cg-ancestor")
+	ancestor := filepath.Join("/sys/fs/cgroup", ancestorRel)
+	if err := os.Mkdir(ancestor, 0755); err != nil {
+		t.Skipf("cannot create ancestor cgroup: %v", err)
+	}
+	defer func() {
+		// Children are removed by the sandbox teardown.
+		for i := 0; i < 50; i++ {
+			if err := os.Remove(ancestor); err == nil || os.IsNotExist(err) {
+				return
+			}
... (60 more lines in the full patch)

Automated review agent. Please address valid findings before human review, or close them with a reason.

Comment thread runsc/boot/loader.go Outdated

switch l.state {
case created:
l.setStartupGC(gccontrol.Suspend(configuredMemoryLimit(), 0 /* untrackedMem */))

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.

[🤖🐸🤖] [minor · bug] Loader.run evaluates gccontrol.Suspend before ending the boot startupGC handle

In Loader.run (case created:), l.setStartupGC(gccontrol.Suspend(configuredMemoryLimit(), 0)) evaluates gccontrol.Suspend before l.setStartupGC ends the boot StartupGC handle stored in l.startupGC. If a garbage collection occurred during boot.New (transitioning the boot session to stateResumed), gccontrol.Suspend attaches to the already-resumed session instead of starting a new GC suspension for container startup, even when ample memory headroom is available after the boot GC cycle.

Suggested fix: End the boot startupGC handle before calling gccontrol.Suspend in Loader.run:

	case created:
		l.startupGC.Swap(nil).End()
		l.setStartupGC(gccontrol.Suspend(configuredMemoryLimit(), 0 /* untrackedMem */))
Details (evidence, reproduction and test code)

Evidence: boot.New (runsc/boot/loader.go:1060) stores args.StartupGC in l.startupGC. At runsc/boot/loader.go:1479, l.setStartupGC(gccontrol.Suspend(configuredMemoryLimit(), 0)) evaluates gccontrol.Suspend before entering l.setStartupGC (runsc/boot/loader.go:1429-1434), which calls l.startupGC.Swap(gc).End(). When args.StartupGC is in stateResumed, gccontrol.Suspend (pkg/gccontrol/gccontrol.go:210) increments current.refs without calling startSuspensionLocked, leaving GCPercent enabled for the entire Loader.run startup phase.

Reproduced with a test (runsc/boot/BUILD, runsc/boot/loader_test.go): bazel test //runsc/boot:boot_test --test_filter=TestStartupGC/suspendsOnStartAfterEarlyBootResume --nocache_test_results → Fails at PR head with GCPercent after l.run() = 100, want < 0; passes when l.startupGC.Swap(nil).End() is called before gccontrol.Suspend.

Test code:

diff --git a/runsc/boot/BUILD b/runsc/boot/BUILD
index 5cac89345..b89aa7420 100644
--- a/runsc/boot/BUILD
+++ b/runsc/boot/BUILD
@@ -201,9 +201,11 @@ go_test(
         "//pkg/log",
         "//pkg/seccomp",
         "//pkg/sentry/checkpoint",
+        "//pkg/sentry/control/controlapi",
         "//pkg/sentry/fscheckpoint",
         "//pkg/sentry/kernel",
         "//pkg/sentry/kernel/auth",
+        "//pkg/sentry/state",
         "//pkg/sentry/vfs",
         "//pkg/sync",
         "//pkg/unet",
diff --git a/runsc/boot/loader_test.go b/runsc/boot/loader_test.go
index 785b77d91..820d19de0 100644
--- a/runsc/boot/loader_test.go
+++ b/runsc/boot/loader_test.go
@@ -16,6 +16,7 @@ package boot
 
 import (
 	"fmt"
+	"io"
 	"math"
 	"math/rand"
 	"net"
@@ -37,8 +38,10 @@ import (
 	"gvisor.dev/gvisor/pkg/gccontrol"
 	"gvisor.dev/gvisor/pkg/lisafs"
 	"gvisor.dev/gvisor/pkg/log"
+	"gvisor.dev/gvisor/pkg/sentry/control/controlapi"
 	"gvisor.dev/gvisor/pkg/sentry/kernel"
 	"gvisor.dev/gvisor/pkg/sentry/kernel/auth"
+	"gvisor.dev/gvisor/pkg/sentry/state"
 	"gvisor.dev/gvisor/pkg/sentry/vfs"
 	"gvisor.dev/gvisor/pkg/sync"
 	"gvisor.dev/gvisor/pkg/unet"
@@ -520,6 +523,46 @@ func TestStartupGC(t *testing.T) {
 			t.Fatalf("GCPercent after restore run = %d, want >= 0", got)
 		}
 	})
+
+	t.Run("suspendsOnStartAfterEarlyBootResume", func(t *testing.T) {
+		l, _ := newSuspendedLoader(t)
+		// Simulate GC running during boot.New before StartRoot arrives, which
+		// transitions the boot suspension session to stateResumed.
+		runtime.GC()
+		deadline := time.Now().Add(5 * time.Second)
+		for time.Now().Before(deadline) {
+			if gcPercent() != gcDisabled {
+				break
+			}
+			time.Sleep(time.Millisecond)
+		}
+		if got := gcPercent(); got == gcDisabled {
+			t.Fatal("GC remained disabled after forced collection during boot")
+		}
+		if err := l.run(); err != nil {
+			t.Fatalf("l.run() in state=created: %v", err)
+		}
+		got := gcPercent()
+		l.WaitExit()
+		if got >= 0 {
+			t.Fatalf("GCPercent after l.run() = %d, want < 0", got)
+		}
+	})
+
+	t.Run("resumesStartupGCOnSave", func(t *testing.T) {
+		l, _ := newSuspendedLoader(t)
+		pr, pw := io.Pipe()
+		pr.Close()
+		defer pw.Close()
+		_ = l.saveWithOpts(&state.SaveOpts{
+			Destination: pw,
+			Resume:      true,
+			MemoryLimit: gccontrol.NoMemoryLimit,
+		}, &controlapi.SaveRestoreExecOpts{})
+		if got := gcPercent(); got < 0 {
+			t.Fatalf("GCPercent after saveWithOpts = %d, want >= 0", got)
+		}
+	})
 }
 
 // Test that network=host with raw sockets enabled requires CAP_NET_RAW on the

Automated review agent. Please address valid findings before human review, or close them with a reason.

Sandbox boot, checkpoint save, and checkpoint restore allocate a rapidly
growing Go heap from a small initial GOGC target, triggering repeated GC
cycles on the critical path.

- Add pkg/gccontrol to temporarily disable periodic GC under a
  cgroup-aware soft memory limit, resuming regular GC automatically if
  the limit is reached.

- Suspend GC at the start of `runsc boot` until the sandbox is idle for
  250 ms or at most 500 ms after container start.

- Suspend GC across checkpoint save and restore.

Fixes gvisor#16134
Fixes gvisor#16152
@tamird

tamird commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

@parth-opensrc, on a one-CPU restore of 100,000 empty tmpfs files, both your PR and Etienne’s #16134 reference got the guest running sooner. From the start of restore to the first verified guest read, the median was 670.0 ms on parent 706b124, 554.0 ms with the reference patch 4a7ccbd applied to that parent, and 547.9 ms on c31b2ad. Benchstat found no timing difference between the reference and the PR on this workload.

                              │  reference  │             candidate              │
                              │   sec/op    │   sec/op     vs base               │
Restore/restore_first_read_ns   554.0m ± 2%   547.9m ± 2%       ~ (p=0.750 n=36)

Sentry RSS at the first read was 308.0 MiB on the parent, 315.7 MiB on the reference and 315.9 MiB on the PR. Each run restored a fresh Sentry under a 2 GiB limit; all 111 runs, including warmups, read back the 100,000-file tree. Original measurements · Benchstat.

Posted by Codex on behalf of @tamird.

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.

Optimization: Suspend the Sentry's Go GC while saving a checkpoint Optimization: Suspend the Sentry's Go GC until the container runs

6 participants