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

Prepare /benchexec cgroup inside BenchExec containers for nested uses? #1075

Open
PhilippWendler opened this issue Aug 30, 2024 · 0 comments
Labels

Comments

@PhilippWendler
Copy link
Member

With cgroups v2, it is tricky to benchmark a tool that uses cgroups itself. If the main process of the benchmarked tool is the one that creates subcgroups, it works (this is the case for example in runexec -- runexec -- ..), but if we benchmark a tool that spawns subprocesses and those use cgroups (e.g., by calling runexec), it will not work because the inner runexec will not find an empty and usable cgroup. There are already tools that work like this, and people wanting to benchmark such tools with BenchExec.

The general solution for this is to treat the outer BenchExec container like any other container and prepare its cgroups like in other containers before starting the tool that wants to use cgroups. (In the example above the call chain would thus look like runexec - init.sh (setting up cgroups) - the benchmarked tool - runexec.) This works.

However, in theory BenchExec could do what init.sh does whenever it creates a cgroup for a container: instead of just creating the root cgroup, create two subcgroups named /init (name can be changed) and /benchexec and put the main process into /init. Then any BenchExec process that is used inside a BenchExec container will find and use the (empty) /benchexec cgroup. This should work, but it only solves the "BenchExec used by tool inside BenchExec" use case and not nestings with a different container solution in either place. So it is maybe questionable if we want to special-case this.

Furthermore, BenchExec already now creates up 3 cgroups in up to 2 nesting layers per run, and this would add 2 more cgroups and one more nesting depth. Not sure whether we will eventually hit any kernel levels for deep nestings of containers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

1 participant