Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.1] cgroups: cpuset: fix byte order while parsing cpuset range to bits #3808

Merged
merged 2 commits into from
Apr 7, 2023

Conversation

kolyshkin
Copy link
Contributor

Better late than never, this is a backport of #3611 to release-1.1 branch. See the original PR for details.

@kolyshkin kolyshkin added area/systemd backport/1.1-pr A backport PR to release-1.1 labels Apr 3, 2023
@kolyshkin kolyshkin added this to the 1.1.6 milestone Apr 3, 2023
@kolyshkin kolyshkin changed the title 1.1 cpuset byte order [1.1] cgroups: cpuset: fix byte order while parsing cpuset range to bits Apr 3, 2023
@kolyshkin

This comment was marked as outdated.

@kolyshkin
Copy link
Contributor Author

CI failure in CS9 is being fixed by #3806

Runc parses cpuset range to bits in the case of cgroup v2 + systemd as cgroup driver.
The byte order representation differs from systemd expectation, which will set
different cpuset range in systemd transient unit if the length of parsed byte array exceeds one.

	# cat config.json
	...
	"resources": {
		...
		"cpu": {
			"cpus": "10-23"
		}
	},
	...
	# runc --systemd-cgroup run test
	# cat /run/systemd/transient/runc-test.scope.d/50-AllowedCPUs.conf
	# This is a drop-in unit file extension, created via "systemctl set-property"
	# or an equivalent operation. Do not edit.
	[Scope]
	AllowedCPUs=0-7 10-15

The cpuset.cpus in cgroup will also be set to wrong value after reloading systemd manager configuration.

	# systemctl daemon-reload
	# cat /sys/fs/cgroup/system.slice/runc-test.scope/cpuset.cpus
	0-7,10-15

Signed-off-by: seyeongkim <seyeong.kim@canonical.com>
Signed-off-by: Chengen, Du <chengen.du@canonical.com>
(cherry picked from commit 77cae9a)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Add a test case for an issue fixed by the previous commit.
The env should has more than 8 core CPU to meet the test requirement.

Signed-off-by: Chengen, Du <chengen.du@canonical.com>
(cherry picked from commit 4a8750d)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin force-pushed the 1.1-cpuset-byte-order branch from 6491934 to 165d232 Compare April 6, 2023 22:34
@mrunalp mrunalp merged commit c7a72ab into opencontainers:release-1.1 Apr 7, 2023
@kolyshkin kolyshkin mentioned this pull request Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/systemd backport/1.1-pr A backport PR to release-1.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants