Bruno Haible via Gnulib discussion list <[email protected]> writes:
>> The cgroup constraint would be inferred from:
>> cat $(findmnt -n -t cgroup2 -o target)/$(cut -d: -f3- <
>> /proc/self/cgroup)/cpu.max
>
> On my system, that file does not exist:
That command didn't work for me. But I can use this:
$ podman run --rm -it --cpus=8 fedora:latest \
cat /sys/fs/cgroup/cpu.max | awk '{ print $1 / $2 }'
8
This file doesn't exist on my host machine, though, which is probably
the reason you don't have it either:
$ cat /sys/fs/cgroup/cpu.max
cat: /sys/fs/cgroup/cpu.max: No such file or directory
I'll copy the short description of this file here [1]:
cpu.max
A read-write two value file which exists on non-root cgroups.
The default is “max 100000”.
The maximum bandwidth limit. It’s in the following format:
$MAX $PERIOD
which indicates that the group may consume up to $MAX in each
$PERIOD duration. “max” for $MAX indicates no limit. If only one
number is written, $MAX is updated.
This file affects only processes under the fair-class scheduler.
Collin
[1] https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html