-
Notifications
You must be signed in to change notification settings - Fork 198
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
How to prepare cgroups v2 manually for BenchExec? #1046
Comments
It isn't broken. cgroups v2 were designed such that a cgroup can have either child cgroups or processes (except for a particular case that allows creation of new cgroups in an existing one). So this comes from
This is the cgroup where the BenchExec process was in during its runtime (in your example, What you can do manually in your example is to |
Well, some observations:
But why is benchexec creating a new cgroup when I give it an empty one? Wouldn't it be better to fork and clean up afterwards?
I see - it is weird that completely empyting the subtree control is necessary, but maybe a cgroup quirk (also, benchexec crashes if I clear everything except cpu). I think this could be documented somewhere :) Relating to point 4, wouldn't it be nice if I can start benchexec with |
Yes, you need to clear
I don't really understand this sentence. Are you saying that there is way how BenchExec can do this?
You are not giving an empty cgroup to BenchExec, you are giving it a cgroup that contains the BenchExec process itself. And BenchExec cannot use this cgroup for benchmarking while BenchExec itself is still in this cgroup. So it creates a child cgroup, moves itself to the child cgroup such that the parent is empty, and is then free to use the parent cgroup for benchmarking. This is exactly how working with cgroups v2 is supposed to (and needs to) be done. Don't complain to me about cgroups design. ;-)
Not sure what you mean by "fork and clean up afterwards"? I know forking only as an operation for processes, not for cgroups.
Well, this is just how cgroups v2 work, and it is not even just a quirk, it is one of the core design changes from cgroups v1. If this situation comes up in a BenchExec tutorial, we can explain it, but per se I wouldn't add lots of general cgroups explanations to the BenchExec documentation.
You mean that But note that it would not solve the "interactive container" use case. If you start a container with standard cgroup setup and inside start something like |
Ah! Yes, that explains what is going on. I didn't grasp this fully, sorry!
Fair point, I misunderstood something :)
Agree, it is not important for using benchexec.
Yes, I think this would be a good alternative to using systemd.
With --cgroupns=host it would work ;) Jokes aside, it could also work if I With now understanding cgroups a bit better, I think I have an idea how to approach the interactive docker problem somewhat reliably. |
(closing the issue as it is a non-issue, just me not understanding things) |
For those who have the same question as this issue's title, we are discussing some useful scripts and a tutorial in #1048. |
Consider a case where cgroups are manually managed (e.g. a container without systemd).
Then, I might create a cgroup (
mkdir /sys/fs/cgroup/benchexec
) and execute benchexec on that (cgexec -g *:benchexec runexec echo
).Running for the first time works, running for the second time does not (
cgroup change of group failed
).After running
runexec
, the cgroup seems to be broken, I cannot assign any other process to the cgroup (echo $$ > /sys/fs/cgroup/benchexec/cgroup.procs
fails with "Device or resource busy")Script to reproduce (should work on any system with cgroupv2):
This also leaves behind a sub-cgroup
benchexec_process_<id>
.The text was updated successfully, but these errors were encountered: