Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix lxcfs cpuinfo not respecting cpuset when
executor.child_cgroups_enabled
is set.On initialization, lxcfs looks up the current cgroup for pid 1 (in the current pid namespace) and makes an assumption that this cgroup's controllers will be the same controllers that are enabled for all child cgroups: https://github.com/lxc/lxcfs/blob/42b57f265a31261a0b69dc1f040cbcfe58a9c6a1/src/cgroups/cgfsng.c#L1036-L1054
So to make lxcfs happy, we need to enable cgroup controllers in the executor cgroup before starting lxcfs.
The fact that we aren't explicitly enabling cgroup controllers in the child cgroups made me wonder whether cgroups were working at all. After some experimentation, it seems that these cgroup controllers are only getting enabled because crun automatically enables them for us (based on the contents of
buildbuddy.executor/cgroup.controllers
before and after running a container). We can't rely on this automatic setup for lxcfs though, because at the time when we start lxcfs, we haven't yet invoked crun for the first time, so it hasn't set up the controllers for us.