open-nomad/drivers
Mahmood Ali d5e136b82b
executor: set CpuWeight in cgroup-v2 (#11287)
Cgroup-v2 uses `cpu.weight` property instead of cpu shares:
https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#cpu-interface-files
. And it uses a different range (i.e. `[1, 10000]`) from cpu.shares
(i.e. `[2, 262144]`) to make things more interesting.

Luckily, the libcontainer provides a helper function to perform the
conversion
[`ConvertCPUSharesToCgroupV2Value`](https://pkg.go.dev/github.com/opencontainers/runc@v1.0.2/libcontainer/cgroups#ConvertCPUSharesToCgroupV2Value).

I have confirmed that docker/libcontainer performs the conversion as
well in
https://github.com/opencontainers/runc/blob/v1.0.2/libcontainer/specconv/spec_linux.go#L536-L541
, and that CpuShares is ignored by libcontainer in
https://github.com/opencontainers/runc/blob/v1.0.2/libcontainer/cgroups/fs2/cpu.go#L24-L29
.
2021-10-14 08:46:07 -04:00
..
docker gofmt all the files 2021-10-01 10:14:28 -04:00
exec gofmt all the files 2021-10-01 10:14:28 -04:00
java client/fingerprint/java: improve java version string regex matching 2021-06-15 14:15:01 -05:00
mock Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
qemu qemu: set the number of cores equal to the number of reserved cores if set 2021-04-15 13:32:33 -04:00
rawexec gofmt all the files 2021-10-01 10:14:28 -04:00
shared executor: set CpuWeight in cgroup-v2 (#11287) 2021-10-14 08:46:07 -04:00