Thanks to visit codestin.com
Credit goes to github.com

Skip to content

runsc/cgroup: set swap for precreated cgroups#13276

Merged
copybara-service[bot] merged 1 commit into
google:masterfrom
Haihan-Jiang:codex/gvisor-cgroup-swap
Jun 11, 2026
Merged

runsc/cgroup: set swap for precreated cgroups#13276
copybara-service[bot] merged 1 commit into
google:masterfrom
Haihan-Jiang:codex/gvisor-cgroup-swap

Conversation

@Haihan-Jiang

Copy link
Copy Markdown
Contributor

Summary

  • honor OCI LinuxResources.Memory.Swap for cgroup v2 paths that were pre-created by the caller
  • keep the existing pre-created-cgroup ownership behavior for other resource knobs, so runsc does not overwrite pod CPU or memory limits it does not own
  • add a regression test that verifies memory.swap.max is updated while memory.max stays untouched

Fixes #13267

Testing

  • git diff --check
  • bazel test //runsc/cgroup:cgroup_test (fails before running tests on this macOS host because /usr/bin/x86_64-linux-gnu-gcc is not installed for the //vdso:vdso genrule)

@Haihan-Jiang Haihan-Jiang marked this pull request as ready for review May 24, 2026 17:02
@Haihan-Jiang

Copy link
Copy Markdown
Contributor Author

This is ready for review. The patch applies swap settings for precreated cgroup v2 paths and adds coverage in cgroup_v2_test. The visible checks are green.

@fvoznika fvoznika self-assigned this Jun 11, 2026

@fvoznika fvoznika 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 for the fix

copybara-service Bot pushed a commit that referenced this pull request Jun 11, 2026
## Summary
- honor OCI `LinuxResources.Memory.Swap` for cgroup v2 paths that were pre-created by the caller
- keep the existing pre-created-cgroup ownership behavior for other resource knobs, so runsc does not overwrite pod CPU or memory limits it does not own
- add a regression test that verifies `memory.swap.max` is updated while `memory.max` stays untouched

Fixes #13267

## Testing
- `git diff --check`
- `bazel test //runsc/cgroup:cgroup_test` (fails before running tests on this macOS host because `/usr/bin/x86_64-linux-gnu-gcc` is not installed for the `//vdso:vdso` genrule)

FUTURE_COPYBARA_INTEGRATE_REVIEW=#13276 from Haihan-Jiang:codex/gvisor-cgroup-swap b393e6f
PiperOrigin-RevId: 930735286
@copybara-service copybara-service Bot merged commit d127ea0 into google:master Jun 11, 2026
10 checks passed
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.

runsc does not honor OCI LinuxResources.Memory.Swap when joining the pod cgroup, leaving K8s LimitedSwap unenforced for gVisor pods

2 participants