add support exec-cpu-affinity #3164
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add cpu affinity setting to the executed process.
Based on the following code, I added support for setting cpu affinity in Youki.
The implementation sets cpu affinity both before and after moving the intermediate process into the cgroup.
I also created tests based on the test cases from runc.
Summary
container_intermediate_processbefore moving to cgroup.container_intermediate_processafter cgroup move.cpu_affinitymodule for parsing cpuset strings and callingsched_setaffinity.Includes test coverage via
contestfor:Type of Change
Testing
Related Issues
Fixes #2795
Additional Context
In runc,
exec_cpu_affinityis introduced in version 1.3.0.Since the current CI uses an older version of runc1.1.11,
exec_cpu_affinityis not available and the test(just validate-contest-runc) will be skipped. The tests passed successfully when using runc version 1.3.0-rc.1.