Skip to content

runsc/cgroup: set swap for precreated cgroups - #13276

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

copybara-service[bot] merged 1 commit into
gvisor: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 added the ready to pull Causes the PR to be imported into Google. Will be removed soon. label 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 gvisor:master Jun 11, 2026
8 checks passed
hanzo-dev pushed a commit to hanzoai/visor that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to pull Causes the PR to be imported into Google. Will be removed soon.

2 participants