-
Notifications
You must be signed in to change notification settings - Fork 22
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
(RHEL-9322) cgroup: drastically simplify caching of cgroups members mask #295
base: rhel-8.10.0
Are you sure you want to change the base?
(RHEL-9322) cgroup: drastically simplify caching of cgroups members mask #295
Commits on Apr 9, 2024
-
cgroup-util: add mask definitions for sets of controllers supported b…
…y cgroupsv1 vs. cgroupsv2 (cherry picked from commit 4edd65e) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for f5021ec - Browse repository at this point
Copy the full SHA f5021ecView commit details -
cgroup: dump delegation mask too
(cherry picked from commit 0adf88b) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for 506aa4b - Browse repository at this point
Copy the full SHA 506aa4bView commit details -
cgroup: units that aren't loaded properly should not result in cgroup…
… controllers being pulled in This shouldn't make much difference in real life, but is a bit cleaner. (cherry picked from commit 442ce77) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for 3aa896a - Browse repository at this point
Copy the full SHA 3aa896aView commit details -
cgroup: be more careful with which controllers we can enable/disable …
…on a cgroup This changes cg_enable_everywhere() to return which controllers are enabled for the specified cgroup. This information is then used to correctly track the enablement mask currently in effect for a unit. Moreover, when we try to turn off a controller, and this works, then this is indicates that the parent unit might succesfully turn it off now, too as our unit might have kept it busy. So far, when realizing cgroups, i.e. when syncing up the kernel representation of relevant cgroups with our own idea we would strictly work from the root to the leaves. This is generally a good approach, as when controllers are enabled this has to happen in root-to-leaves order. However, when controllers are disabled this has to happen in the opposite order: in leaves-to-root order (this is because controllers can only be enabled in a child if it is already enabled in the parent, and if it shall be disabled in the parent then it has to be disabled in the child first, otherwise it is considered busy when it is attempted to remove it in the parent). To make things complicated when invalidating a unit's cgroup membershup systemd can actually turn off some controllers previously turned on at the very same time as it turns on other controllers previously turned off. In such a case we have to work up leaves-to-root *and* root-to-leaves right after each other. With this patch this is implemented: we still generally operate root-to-leaves, but as soon as we noticed we successfully turned off a controller previously turned on for a cgroup we'll re-enqueue the cgroup realization for all parents of a unit, thus implementing leaves-to-root where necessary. (cherry picked from commit 27adcc9) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for a778f9a - Browse repository at this point
Copy the full SHA a778f9aView commit details -
cgroup: extend reasons when we realize the enable mask
After creating a cgroup we need to initialize its "cgroup.subtree_control" file with the controllers its children want to use. Currently we do so whenever the mkdir() on the cgroup succeeded, i.e. when we know the cgroup is "fresh". Let's update the condition slightly that we also do so when internally we assume a cgroup doesn't exist yet, even if it already does (maybe left-over from a previous run). This shouldn't change anything IRL but make things a bit more robust. (cherry picked from commit 1fd3a10) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for c0f5211 - Browse repository at this point
Copy the full SHA c0f5211View commit details -
cgroup: drastically simplify caching of cgroups members mask
Previously we tried to be smart: when a new unit appeared and it only added controllers to the cgroup mask we'd update the cached members mask in all parents by ORing in the controller flags in their cached values. Unfortunately this was quite broken, as we missed some conditions when this cache had to be reset (for example, when a unit got unloaded), moreover the optimization doesn't work when a controller is removed anyway (as in that case there's no other way for the parent to iterate though all children if any other, remaining child unit still needs it). Hence, let's simplify the logic substantially: instead of updating the cache on the right events (which we didn't get right), let's simply invalidate the cache, and generate it lazily when we encounter it later. This should actually result in better behaviour as we don't have to calculate the new members mask for a whole subtree whever we have the suspicion something changed, but can delay it to the point where we actually need the members mask. This allows us to simplify things quite a bit, which is good, since validating this cache for correctness is hard enough. Fixes: #9512 (cherry picked from commit 5af8805) Resolves: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for 3cbb9c2 - Browse repository at this point
Copy the full SHA 3cbb9c2View commit details -
cgroup: when we unload a unit, also update all its parent's members mask
This way we can corectly ensure that when a unit that requires some controller goes away, we propagate the removal of it all the way up, so that the controller is turned off in all the parents too. (cherry picked from commit b8b6f32) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for cc01fa3 - Browse repository at this point
Copy the full SHA cc01fa3View commit details
Commits on May 21, 2024
-
test: extend testcase to ensure controller membership doesn't regress
(cherry picked from commit 43738e0) Related: RHEL-9322
Configuration menu - View commit details
-
Copy full SHA for b719f06 - Browse repository at this point
Copy the full SHA b719f06View commit details